Esempio n. 1
0
    def serialize(self):
        code = ""
        code += s_u32(self._cinit_index)
        code += s_u32(len(self.traits))
        for trait in self.traits:
            code += trait.serialize()

        return code
Esempio n. 2
0
 def serialize(self):
     code = ""
     code += s_u32(self.from_)
     code += s_u32(self.to_)
     code += s_u32(self.target)
     code += s_u32(self._exc_type_index)
     code += s_u32(self._var_name_index)
     return code
Esempio n. 3
0
 def serialize(self):
     code = ""
     code += s_u32(self.from_)
     code += s_u32(self.to_)
     code += s_u32(self.target)
     code += s_u32(self._exc_type_index)
     code += s_u32(self._var_name_index)
     return code
Esempio n. 4
0
    def serialize(self):
        code = ""
        code += s_u32(self._cinit_index)
        code += s_u32(len(self.traits))
        for trait in self.traits:
            code += trait.serialize()

        return code
Esempio n. 5
0
    def serialize_inner(self):
        code = ""

        code += s_u32(self.slot_id)
        code += s_u32(self._type_name_index)
        code += s_u32(self._default_index)
        if self._default_index:
            code += s_u32(self._default_kind)

        return code
Esempio n. 6
0
    def serialize_inner(self):
        code = ""

        code += s_u32(self.slot_id)
        code += s_u32(self._type_name_index)
        code += s_u32(self._default_index)
        if self._default_index:
            code += s_u32(self._default_kind)

        return code
Esempio n. 7
0
    def serialize(self):
        code = ""
        code += s_u32(self._name_index)
        code += s_u32(len(self.items))

        for key_i in self._keys_indices:
            code += s_u32(key_i)

        for val_i in self._values_indices:
            code += s_u32(val_i)

        return code
Esempio n. 8
0
    def serialize(self):
        code = ""
        code += s_u32(self._name_index)
        code += s_u32(len(self.items))

        for key_i in self._keys_indices:
            code += s_u32(key_i)

        for val_i in self._values_indices:
            code += s_u32(val_i)

        return code
Esempio n. 9
0
    def serialize(self):
        self.code.emit('returnvoid')

#        if self.optimize:
#            self.code.optimize()

        self.code.pass1()

        code = ""
        code += s_u32(self._method_info_index)
        code += s_u32(self.code.max_stack_depth)
        code += s_u32(self.code.max_local_count)
        code += s_u32(0)
        code += s_u32(self.code.max_scope_depth)
        body = self.code.serialize()
        code += s_u32(len(body))
        code += body

        code += s_u32(len(self.exceptions))
        for exc in self.exceptions or []:
            code += exc.serialize()

        code += s_u32(len(self.traits))
        for trait in self.traits or []:
            code += trait.serialize()

        return code
Esempio n. 10
0
    def serialize(self):
        self.code.emit("returnvoid")

        #        if self.optimize:
        #            self.code.optimize()

        self.code.pass1()

        code = ""
        code += s_u32(self._method_info_index)
        code += s_u32(self.code.max_stack_depth)
        code += s_u32(self.code.max_local_count)
        code += s_u32(0)
        code += s_u32(self.code.max_scope_depth)
        body = self.code.serialize()
        code += s_u32(len(body))
        code += body

        code += s_u32(len(self.exceptions))
        for exc in self.exceptions or []:
            code += exc.serialize()

        code += s_u32(len(self.traits))
        for trait in self.traits or []:
            code += trait.serialize()

        return code
Esempio n. 11
0
 def write_pool(pool, prefix_count=True):
     code = ""
     if prefix_count:
         code += s_u32(len(pool))
     for item in pool:
         code += item.serialize()
     return code
Esempio n. 12
0
 def write_pool(pool, prefix_count=True):
     code = ""
     if prefix_count:
         code += s_u32(len(pool))
     for item in pool:
         code += item.serialize()
     return code
Esempio n. 13
0
    def serialize(self):
        code = ""

        code += s_u32(len(self.param_types))
        code += s_u32(self._return_type_index)

        code += ''.join(s_u32(index) for index in self._param_types_indices)
        code += s_u32(self._namestr_index)

        if self.options:
            self.flags |= MethodFlag.HasOptional

        if self.param_names:
            self.flags |= MethodFlag.HasParamNames

        if self.varargs:
            self.flags |= MethodFlag.NeedRest

        code += chr(self.flags & 0xFF)

        if self.options:
            code += s_u32(len(self.options))
            for ctype, index in self._options_indices:
                code += s_u32(index)
                code += chr(ctype)

        if self.param_names:
            code += ''.join(s_u32(index) for index in self._param_names_indices)

        return code
Esempio n. 14
0
    def serialize(self):
        code = ""
        code += s_u32(self._name_index)
        code += s_u32(self._super_name_index)

        # Flags
        flags = BitStream()
        flags.write(Zero[4])                  # first four bits = not defined
        flags.write(self.protectedNs != None) # 1000 = 0x08 = CLASSFLAG_ClassProtectedNs
        flags.write(self.is_interface)        # 0100 = 0x04 = CLASSFLAG_ClassInterface
        flags.write(self.is_final)            # 0010 = 0x02 = CLASSFLAG_ClassFinal
        flags.write(self.is_sealed)           # 0001 = 0x01 = CLASSFLAG_ClassSealed

        code += flags.serialize()

        if self.protectedNs:
            code += s_u32(self._protectedNs_index)

        code += s_u32(len(self.interfaces))
        for index in self._interface_indices:
            code += s_u32(index)

        code += s_u32(self._iinit_index)

        code += s_u32(len(self.traits))
        for trait in self.traits:
            code += trait.serialize()

        return code
Esempio n. 15
0
    def serialize(self):
        code = ""
        code += s_u32(self._name_index)
        code += s_u32(self._super_name_index)

        # Flags
        flags = BitStream()
        flags.write(Zero[4])  # first four bits = not defined
        flags.write(self.protectedNs != None)  # 1000 = 0x08 = CLASSFLAG_ClassProtectedNs
        flags.write(self.is_interface)  # 0100 = 0x04 = CLASSFLAG_ClassInterface
        flags.write(self.is_final)  # 0010 = 0x02 = CLASSFLAG_ClassFinal
        flags.write(self.is_sealed)  # 0001 = 0x01 = CLASSFLAG_ClassSealed

        code += flags.serialize()

        if self.protectedNs:
            code += s_u32(self._protectedNs_index)

        code += s_u32(len(self.interfaces))
        for index in self._interface_indices:
            code += s_u32(index)

        code += s_u32(self._iinit_index)

        code += s_u32(len(self.traits))
        for trait in self.traits:
            code += trait.serialize()

        return code
Esempio n. 16
0
    def serialize(self):
        code = ""

        code += s_u32(len(self.param_types))
        code += s_u32(self._return_type_index)

        code += "".join(s_u32(index) for index in self._param_types_indices)
        code += s_u32(self._namestr_index)

        if self.options:
            self.flags |= MethodFlag.HasOptional

        if self.param_names:
            self.flags |= MethodFlag.HasParamNames

        if self.varargs:
            self.flags |= MethodFlag.NeedRest

        code += chr(self.flags & 0xFF)

        if self.options:
            code += s_u32(len(self.options))
            for ctype, index in self._options_indices:
                code += s_u32(index)
                code += chr(ctype)

        if self.param_names:
            code += "".join(s_u32(index) for index in self._param_names_indices)

        return code
Esempio n. 17
0
    def serialize(self):
        code = ""
        code += s_u32(self._name_index)

        flags = BitStream()
        flags.write(False)
        flags.write(bool(self.metadata)) # Has Metadata
        flags.write(self.is_override)    # Is Override
        flags.write(self.is_final)       # Is Final
        flags.write(self.kind, UB[4])    # kind

        code += flags.serialize()
        code += self.serialize_inner()

        if self.metadata:
            code += s_u32(len(self.metadata))
            for m in self._metadata_indices:
                code += s_u32(m)
        return code
Esempio n. 18
0
    def serialize(self):
        code = ""
        code += s_u32(self._name_index)

        flags = BitStream()
        flags.write(False)
        flags.write(bool(self.metadata))  # Has Metadata
        flags.write(self.is_override)  # Is Override
        flags.write(self.is_final)  # Is Final
        flags.write(self.kind, UB[4])  # kind

        code += flags.serialize()
        code += self.serialize_inner()

        if self.metadata:
            code += s_u32(len(self.metadata))
            for m in self._metadata_indices:
                code += s_u32(m)
        return code
Esempio n. 19
0
 def serialize_inner(self):
     return s_u32(self.slot_id) + s_u32(self._cls_index)
Esempio n. 20
0
 def serialize_inner(self):
     return s_u32(self.disp_id) + s_u32(self._method_index)
Esempio n. 21
0
 def serialize_inner(self):
     return s_u32(self.slot_id) + s_u32(self._function_index)
Esempio n. 22
0
 def serialize_inner(self):
     return s_u32(self.slot_id) + s_u32(self._cls_index)
Esempio n. 23
0
 def serialize_inner(self):
     return s_u32(self.disp_id) + s_u32(self._method_index)
Esempio n. 24
0
 def serialize_inner(self):
     return s_u32(self.slot_id) + s_u32(self._function_index)