Пример #1
0
    def VisitConstructorDecl(self, node):
        node.env.Update(self.PassVisit(node.env, node.params))
        self.ForkVisit(node.env, node.body)

        env = Environment()
        env.AddMethod(node.name.lexeme, node)
        return env
Пример #2
0
    def VisitLocalVarDecl(self, node):
        self.ForkVisit(node.env, node.var_decl)
        self.PassVisit(node.env, node.l_type)

        env = Environment()
        env.AddLocalVar(node.var_decl.var_id.lexeme, node)
        return env
Пример #3
0
    def VisitMethodHeader(self, node):
        self.PassVisit(node.env, node.m_type)
        self.PassVisit(node.env, node.params)

        env = Environment()
        env.Update(self.PassVisit(node.env, node.params))
        return env
Пример #4
0
    def VisitInterfaceDecl(self, node):
        node.env.Update(self.ForkVisit(node.env, node.method_decls))
        self.PassVisit(node.env, node.extends_interface)

        env = Environment()
        env.AddClassOrInterface(node.name.lexeme, node)
        return env
Пример #5
0
    def VisitMethodDecl(self, node):
        node.env.Update(self.ForkVisit(node.env, node.header))
        node.env.Update(self.ForkVisit(node.env, node.body_block))

        env = Environment()
        env.AddMethod(node.header.m_id.lexeme, node)
        return env
Пример #6
0
    def VisitFieldDecl(self, node):
        node.env.Update(self.ForkVisit(node.env, node.var_decl))
        self.PassVisit(node.env, node.f_type)
        self.PassVisit(node.env, node.var_decl)

        env = Environment()
        env.AddField(node.var_decl.var_id.lexeme, node)
        return env
Пример #7
0
    def VisitClassDecl(self, node):
        self.PassVisit(node.env, node.extends)
        self.PassVisit(node.env, node.interfaces)
        node.env.Update(self.ForkVisit(node.env, node.method_decls))
        node.env.Update(self.ForkVisit(node.env, node.constructor_decls))
        node.env.Update(self.ForkVisit(node.env, node.field_decls))

        env = Environment()
        env.AddClassOrInterface(node.name.lexeme, node)
        return env
Пример #8
0
    def VisitBlock(self, node):
        env = node.env.upstream.Fork()
        if node.stmts:
            for stmt in node.stmts:
                update = self.ForkVisit(env, stmt)
                env = env.Fork()
                env.Update(update)

        return Environment.Empty()
Пример #9
0
 def VisitImportDecl(self, node):
     return Environment.Empty()
Пример #10
0
    def VisitParameter(self, node):
        self.PassVisit(node.env, node.p_type)

        env = Environment()
        env.AddParameter(node.var_id.lexeme, node)
        return env
Пример #11
0
 def VisitWhileStatement(self, node):
     self.PassVisit(node.env, node.test_expr)
     self.ForkVisit(node.env, node.body)
     return Environment.Empty()
Пример #12
0
 def VisitReturnStatement(self, node):
     self.PassVisit(node.env, node.exp)
     return Environment.Empty()
Пример #13
0
 def VisitArrayCreationExpression(self, node):
     self.PassVisit(node.env, node.a_type)
     self.PassVisit(node.env, node.exp)
     return Environment.Empty()
Пример #14
0
 def VisitArrayAccess(self, node):
     self.PassVisit(node.env, node.name_or_primary)
     self.PassVisit(node.env, node.exp)
     return Environment.Empty()
Пример #15
0
 def VisitParensExpression(self, node):
     self.PassVisit(node.env, node.exp)
     return Environment.Empty()
Пример #16
0
 def VisitEmptyStatement(self, node):
     return Environment.Empty()
Пример #17
0
 def VisitUnaryExpression(self, node):
     self.PassVisit(node.env, node.right)
     return Environment.Empty()
Пример #18
0
 def VisitCastExpression(self, node):
     self.PassVisit(node.env, node.cast_type)
     self.PassVisit(node.env, node.exp)
     return Environment.Empty()
Пример #19
0
 def VisitPackageDecl(self, node):
     env = Environment()
     env.AddPackage(node.name.AsString(), node)
     return env
Пример #20
0
 def VisitFieldAccess(self, node):
     self.PassVisit(node.env, node.primary)
     return Environment.Empty()
Пример #21
0
 def VisitNameExpression(self, node):
     self.PassVisit(node.env, node.name)
     return Environment.Empty()
Пример #22
0
 def VisitThisExpression(self, node):
     return Environment.Empty()
Пример #23
0
 def VisitClassInstanceCreationExpression(self, node):
     self.PassVisit(node.env, node.class_type)
     self.PassVisit(node.env, node.args)
     return Environment.Empty()
Пример #24
0
 def VisitStatementExpression(self, node):
     self.PassVisit(node.env, node.stmt)
     return Environment.Empty()
Пример #25
0
 def VisitForStatement(self, node):
     node.env.Update(self.PassVisit(node.env, node.init))
     self.PassVisit(node.env, node.test_expr)
     self.PassVisit(node.env, node.update)
     self.ForkVisit(node.env, node.body)
     return Environment.Empty()
Пример #26
0
 def VisitAssignmentExpression(self, node):
     self.PassVisit(node.env, node.lhs)
     self.PassVisit(node.env, node.exp)
     return Environment.Empty()
Пример #27
0
 def VisitVariableDeclarator(self, node):
     self.PassVisit(node.env, node.exp)
     return Environment.Empty()
Пример #28
0
 def VisitMethodInvocation(self, node):
     self.PassVisit(node.env, node.name)
     self.PassVisit(node.env, node.primary)
     self.PassVisit(node.env, node.args)
     return Environment.Empty()
Пример #29
0
 def VisitIfThenElseStatement(self, node):
     self.PassVisit(node.env, node.test_expr)
     self.ForkVisit(node.env, node.stmt_true)
     self.ForkVisit(node.env, node.stmt_false)
     return Environment.Empty()