def _build_local_typemap(t_param_mapping, typedef_mapping): # for resolving typedefed types in template instance args: local_map = dict((n, t.transformed(typedef_mapping)) for (n, t) in t_param_mapping.items()) # for resolving 'free' typedefs in method args and result types: if set(local_map) & set(typedef_mapping): raise Exception("t_param_mapping and typedef_mapping intersects") local_map.update(typedef_mapping) # resolve indirections induced by update: Utils.flatten(local_map) return local_map
def _build_typedef_mapping(decls): _check_typedefs(decls) mapping = dict((d.name, d.type_) for d in decls) Utils.flatten(mapping) return mapping
def _detect_cycles(inheritance_graph): graph = Utils.remove_labels(inheritance_graph) cycle = Utils.find_cycle(graph) if cycle is not None: info = " -> ".join(map(str, cycle)) raise Exception("inheritance hierarchy contains cycle: " + info)