Esempio n. 1
0
 def get_id_from_json(func_ir: JsonDict) -> str:
     """Get the id from the serialized FuncIR associated with this FuncDecl"""
     decl = func_ir['decl']
     shortname = FuncDecl.compute_shortname(decl['class_name'],
                                            decl['name'])
     fullname = decl['module_name'] + '.' + shortname
     return get_id_from_name(decl['name'], fullname, func_ir['line'])
Esempio n. 2
0
def load_type_map(mapper: 'Mapper',
                  modules: List[MypyFile],
                  deser_ctx: DeserMaps) -> None:
    """Populate a Mapper with deserialized IR from a list of modules."""
    for module in modules:
        for name, node in module.names.items():
            if isinstance(node.node, TypeInfo) and is_from_module(node.node, module):
                ir = deser_ctx.classes[node.node.fullname]
                mapper.type_to_ir[node.node] = ir
                mapper.func_to_decl[node.node] = ir.ctor

    for module in modules:
        for func in get_module_func_defs(module):
            func_id = get_id_from_name(func.name, func.fullname, func.line)
            mapper.func_to_decl[func] = deser_ctx.functions[func_id].decl
Esempio n. 3
0
 def id(self) -> str:
     assert self.line is not None
     return get_id_from_name(self.name, self.fullname, self.line)