示例#1
0
 def __init__(self, reader: MemoryViewReader):
     self.name_index = reader.read_int()
     self.super_name_index = reader.read_int()
     self.flags = ClassFlags(reader.read_u8())
     if ClassFlags.PROTECTED_NS in self.flags:
         self.protected_namespace_index = reader.read_int()
     self.interface_indices = read_array(reader, MemoryViewReader.read_int)
     self.init_index = reader.read_int()
     self.traits = read_array(reader, ASTrait)
示例#2
0
 def __init__(self, reader: MemoryViewReader):
     self.method_index = reader.read_int()
     self.max_stack = reader.read_int()
     self.local_count = reader.read_int()
     self.init_scope_depth = reader.read_int()
     self.max_scope_depth = reader.read_int()
     self.code = reader.read(reader.read_int())
     self.exceptions = read_array(reader, ASException)
     self.traits = read_array(reader, ASTrait)
示例#3
0
 def __init__(self, reader: MemoryViewReader):
     self.param_count = reader.read_int()
     self.return_type_index = reader.read_int()
     self.param_type_indices = read_array(reader, MemoryViewReader.read_int,
                                          self.param_count)
     self.name_index = reader.read_int()
     self.flags = MethodFlags(reader.read_u8())
     if MethodFlags.HAS_OPTIONAL in self.flags:
         self.options = read_array(reader, ASOptionDetail)
     if MethodFlags.HAS_PARAM_NAMES in self.flags:
         self.param_name_indices = read_array(reader,
                                              MemoryViewReader.read_int,
                                              self.param_count)
示例#4
0
 def __init__(self, reader: MemoryViewReader):
     self.minor_version = reader.read_u16()
     self.major_version = reader.read_u16()
     self.constant_pool = ASConstantPool(reader)
     self.methods = read_array(reader, ASMethod)
     self.metadata = read_array(reader, ASMetadata)
     class_count = reader.read_int()
     self.instances = read_array(reader, ASInstance, class_count)
     self.classes = read_array(reader, ASClass, class_count)
     self.scripts = read_array(reader, ASScript)
     self.method_bodies = read_array(reader, ASMethodBody)
示例#5
0
 def __init__(self, reader: MemoryViewReader):
     self.name_index = reader.read_int()
     kind = reader.read_u8()
     self.kind = TraitKind(kind & 0x0F)
     self.attributes = TraitAttributes(kind >> 4)
     if self.kind in (TraitKind.SLOT, TraitKind.CONST):
         self.data = ASTraitSlot(reader)
     elif self.kind == TraitKind.CLASS:
         self.data = ASTraitClass(reader)
     elif self.kind == TraitKind.FUNCTION:
         self.data = ASTraitFunction(reader)
     elif self.kind in (TraitKind.METHOD, TraitKind.GETTER,
                        TraitKind.SETTER):
         self.data = ASTraitMethod(reader)
     else:
         assert False, 'unreachable code'
     if TraitAttributes.METADATA in self.attributes:
         self.metadata = read_array(reader, MemoryViewReader.read_int)
示例#6
0
 def __init__(self, reader: MemoryViewReader):
     self.kind = MultinameKind(reader.read_u8())
     if self.kind in (MultinameKind.Q_NAME, MultinameKind.Q_NAME_A):
         self.namespace_index = reader.read_int()
         self.name_index = reader.read_int()
     elif self.kind in (MultinameKind.RTQ_NAME, MultinameKind.RTQ_NAME_A):
         self.name_index = reader.read_int()
     elif self.kind in (MultinameKind.RTQ_NAME_L,
                        MultinameKind.RTQ_NAME_LA):
         pass
     elif self.kind in (MultinameKind.MULTINAME, MultinameKind.MULTINAME_A):
         self.name_index = reader.read_int()
         self.namespace_set_index = reader.read_int()
     elif self.kind in (MultinameKind.MULTINAME_L,
                        MultinameKind.MULTINAME_LA):
         self.namespace_set_index = reader.read_int()
     elif self.kind == MultinameKind.TYPE_NAME:
         self.q_name_index = reader.read_int()
         self.type_indices = read_array(reader, MemoryViewReader.read_int)
     else:
         assert False, 'unreachable code'
示例#7
0
 def __init__(self, reader: MemoryViewReader):
     self.namespaces = read_array(reader, MemoryViewReader.read_int)
示例#8
0
 def __init__(self, reader: MemoryViewReader):
     self.init_index = reader.read_int()
     self.traits = read_array(reader, ASTrait)
示例#9
0
 def __init__(self, reader: MemoryViewReader):
     self.name_index = reader.read_int()
     self.items = read_array(reader, ASItem)