コード例 #1
0
        public PrinterNode Visit(ForNode node)
        {
            var pNode = new PrinterNode($"For {node.Direction.ToString()}");

            pNode.AddChild(node.Initial.Accept(this));
            pNode.AddChild(node.Final.Accept(this));
            pNode.AddChild(node.Body.Accept(this));
            return(pNode);
        }
コード例 #2
0
        public bool Visit(ForNode node)
        {
            node.Initial.Accept(this);
            node.Final.Accept(this);

            _typeChecker.RequireCast(_stack.SymInt, ref node.Initial.Left);
            _typeChecker.RequireCast(_stack.SymInt, ref node.Final);

            return(true);
        }