Exemple #1
0
        public override dynamic Visit(ProgramNode node)
        {
            var mainVisitor = new CfgVisitor(CurrentScope, _result);

            mainVisitor.Visit((FunctionDeclarationNode)node.MainBlock);
            // _result.AddRange(mainVisitor._result);
            // node.MainBlock.Accept(this);

            node.DeclarationBlock.Accept(this);

            return(_result);
        }
Exemple #2
0
        public override dynamic Visit(FunctionDeclarationNode node)
        {
            var functionVisitor = new CfgVisitor(CurrentScope, _result);

            functionVisitor.Visit((StatementListNode)node.Statement);
            var cfg = new CFG
            {
                Blocks   = functionVisitor._blocks,
                Function = node.Function
            };

            _result.Add(cfg);
            //node.Statement.Accept(this);

            return(null);
        }