コード例 #1
0
        public void Process(FunctionDefinitionNode function)
        {
            SyntaxTreeDelegator visitor            = new SyntaxTreeDelegator();
            StatementDelegator  statementDelegator = new StatementDelegator();

            statementDelegator.DeclarationVisitor = this;
            visitor.StatementVisitor = statementDelegator;

            SyntaxTreeDelegator      childrenVisitor          = new SyntaxTreeDelegator();
            StatementChildrenVisitor statementChildrenVisitor = new StatementChildrenVisitor(visitor, childrenVisitor);

            childrenVisitor.StatementVisitor = statementChildrenVisitor;

            function.Body.VisitStatements(statementChildrenVisitor);
        }
コード例 #2
0
        public void Process()
        {
            SyntaxTreeDelegator      syntaxTreeDelegator      = new SyntaxTreeDelegator();
            StatementDelegator       statementDelegator       = new StatementDelegator();
            ExpressionDelegator      expressionDelegator      = new ExpressionDelegator();
            BasicExpressionDelegator basicExpressionDelegator = new BasicExpressionDelegator();

            syntaxTreeDelegator.StatementVisitor       = statementDelegator;
            statementDelegator.ReturnVisitor           = this;
            syntaxTreeDelegator.ExpressionVisitor      = expressionDelegator;
            expressionDelegator.BasicVisitor           = basicExpressionDelegator;
            basicExpressionDelegator.AssignmentVisitor = this;

            SyntaxTreeDelegator      childrenVisitor          = new SyntaxTreeDelegator();
            StatementChildrenVisitor statementChildrenVisitor =
                new StatementChildrenVisitor(syntaxTreeDelegator, childrenVisitor);

            childrenVisitor.StatementVisitor  = statementChildrenVisitor;
            childrenVisitor.ExpressionVisitor = new ExpressionChildrenVisitor(syntaxTreeDelegator, null, childrenVisitor);

            _function.Body.VisitStatements(statementChildrenVisitor);
        }
コード例 #3
0
        public void Process(FunctionDefinitionNode function)
        {
            SyntaxTreeDelegator visitor            = new SyntaxTreeDelegator();
            StatementDelegator  statementDelegator = new StatementDelegator();

            visitor.StatementVisitor = statementDelegator;
            statementDelegator.DeclarationVisitor = this;

            SyntaxTreeDelegator      childrenVisitor          = new SyntaxTreeDelegator();
            StatementChildrenVisitor statementChildrenVisitor = new StatementChildrenVisitor(visitor, childrenVisitor);

            childrenVisitor.StatementVisitor = statementChildrenVisitor;

            // Populate lvalue list
            function.Body.AcceptStatementVisitor(statementChildrenVisitor);

            // Validate usage of all lvalues.
            foreach (LValue lvalue in _lvalues)
            {
                _lValueAssignmentValidator.Validate(lvalue, function);
            }
        }