示例#1
0
    def visit(node):
        # First is a simple check to see if the value is set in the node.
        # if so then the parameter is assigned
        for p in func.parameters():
            if p.is_assigned:
                continue

            addr = GDScriptAddress.calc_address(ADDRESS_MODE_STACK, p.index)
            if addr in node.defs:
                p.is_assigned = True
            else:
                addr = GDScriptAddress.calc_address(ADDRESS_MODE_STACKVARIABLE, p.index)
                if addr in node.defs:
                    p.is_assigned = True
示例#2
0
 def __init__(self, name: str, index: int, vtype: Union[VariantType, str,
                                                        int]):
     self.is_inherited = False
     self.name = name
     self.index = index
     self.vtype = VariantType.get(vtype)
     self.address = GDScriptAddress.create(ADDRESS_MODE_MEMBER, index)
示例#3
0
 def __init__(self, name: str, vtype: Union[VariantType, int], index: int):
     self.name = name        
     self.vtype = VariantType.get(vtype)
     self.index = index
     self.is_assigned = False
     self.address = GDScriptAddress.create(ADDRESS_MODE_STACKVARIABLE, index)
     self.is_optional = False
示例#4
0
 def __init__(self, index: int, vtype: Union[VariantType, str, int],
              data: bytes, declaration: str):
     self.index = index
     self.vtype = VariantType.get(vtype)
     self.data = data
     self.declaration = declaration
     self.address = GDScriptAddress.create(ADDRESS_MODE_LOCALCONSTANT,
                                           index)
示例#5
0
 def __init__(self, index: int, name: str, original_name: str, vtype: int, kind_code: int, value: str, source: Union[str, int]):
     self.index = index
     self.original_name = original_name
     self.vtype = VariantType.get(vtype)
     self.kind_code = kind_code
     self.value = value
     self.address = GDScriptAddress.create(ADDRESS_MODE_GLOBAL, index)
     if isinstance(source, str):
         if source == "GlobalConstants":
             self.source = GDScriptGlobal.SOURCE_CONSTANT
         elif source == "hard-coded":
             self.source = GDScriptGlobal.SOURCE_HARDCODED
         elif source == "ClassDB":
             self.source = GDScriptGlobal.SOURCE_CLASSDB
         elif source == "Singleton":
             self.source = GDScriptGlobal.SOURCE_SINGLETON
     elif isinstance(source, int):
         assert source in ( \
             GDScriptGlobal.SOURCE_CONSTANT, \
             GDScriptGlobal.SOURCE_HARDCODED, \
             GDScriptGlobal.SOURCE_CLASSDB, \
             GDScriptGlobal.SOURCE_SINGLETON)
         self.source = source
示例#6
0
 def new_stack_variable(self, vtype: VariantType) -> GDScriptAddress:
     addr = GDScriptAddress.create(ADDRESS_MODE_STACKVARIABLE,
                                   self.stack_size)
     self.stack_size += 1
     return addr