(self, type_)
return typemap[type_]
Recursively recreate the given type within the manager.

        This proceeds iteratively on the structure of the type tree.
Recursively recreate the given type within the manager.
Recursively recreate the given type within the manager .
def normalize(self, type_):
        """Recursively recreate the given type within the manager.

        This proceeds iteratively on the structure of the type tree.
        """
        stack = [type_]
        typemap = {}
        while stack:
            ty = stack.pop()
            if ty.arity == 0:
                if (ty.is_bool_type() or ty.is_int_type() or
                    ty.is_real_type() or ty.is_string_type()):
                    myty = ty
                elif ty.is_bv_type():
                    myty = self.BVType(ty.width)
                else:
                    myty = self.Type(ty.basename, arity=0)
                typemap[ty] = myty
            else:
                missing = [subtype for subtype in ty.args\
                           if subtype not in typemap]
                if missing:
                    # At least one type still needs to be converted
                    stack.append(ty)
                    stack += missing
                else:
                    if ty.is_array_type():
                        index_type = typemap[ty.index_type]
                        elem_type = typemap[ty.elem_type]
                        myty = self.ArrayType(index_type, elem_type)
                    elif ty.is_function_type():
                        param_types = (typemap[a] for a in ty.param_types)
                        return_type = typemap[ty.return_type]
                        myty = self.FunctionType(return_type, param_types)
                    else:
                        # Custom Type
                        typedecl = self.Type(type_.basename, type_.arity)
                        new_args = tuple(typemap[a] for a in type_.args)
                        myty = self.get_type_instance(typedecl, *new_args)
                    typemap[ty] = myty
        return typemap[type_]
def normalize ( self , type_ ) : stack = [ type_ ] typemap = { } while stack : ty = stack . pop ( ) if ty . arity == 0 : if ( ty . is_bool_type ( ) or ty . is_int_type ( ) or ty . is_real_type ( ) or ty . is_string_type ( ) ) : myty = ty elif ty . is_bv_type ( ) : myty = self . BVType ( ty . width ) else : myty = self . Type ( ty . basename , arity = 0 ) typemap [ ty ] = myty else : missing = [ subtype for subtype in ty . args if subtype not in typemap ] if missing : # At least one type still needs to be converted stack . append ( ty ) stack += missing else : if ty . is_array_type ( ) : index_type = typemap [ ty . index_type ] elem_type = typemap [ ty . elem_type ] myty = self . ArrayType ( index_type , elem_type ) elif ty . is_function_type ( ) : param_types = ( typemap [ a ] for a in ty . param_types ) return_type = typemap [ ty . return_type ] myty = self . FunctionType ( return_type , param_types ) else : # Custom Type typedecl = self . Type ( type_ . basename , type_ . arity ) new_args = tuple ( typemap [ a ] for a in type_ . args ) myty = self . get_type_instance ( typedecl , * new_args ) typemap [ ty ] = myty return typemap [ type_ ]