Beispiel #1
0
        public override string Visit(ForAstNode node)
        {
            string iterator = Visit(node.Iterator);
            string startVal = Visit(node.StartValue);
            string endVal   = Visit(node.EndValue);
            string step     = "1";

            IndentationDepth++;
            string body = Visit(node.Body);

            IndentationDepth--;

            if (node.Step != null)
            {
                step = Visit(node.Step);
            }

            string forCode = $"for (int {iterator} = {startVal}; {iterator} <= {endVal}; {iterator} = {iterator} + {step}){{\n{body}}}";

            return(forCode);
        }
Beispiel #2
0
 public override InoTypeEnum Visit(ForAstNode node)
 {
     Visit(node.Body);
     return(InoTypeEnum.undefined);
 }