def v_Function(self, func, ctx): '''Computes the function type and processes all statements.''' assert isinstance(func, ast.Function) scope = types.Scope(ctx[-1]) ctx.append(scope) for (name, argType) in func.GetType().GetArgumentTypes().items(): scope.RegisterVariable(name, argType) self.v_Visit(func.GetBody(), ctx) ctx.pop()
def v_IfStatement(self, stmt, ctx): ctx.append(types.Scope(ctx[-1])) stmt.AcceptVisitor(self, ctx) ctx.pop()
def __init__(self): self.ok = True self.scope = types.Scope() self.__loader = LinearIR.FilesystemModuleLoader()