Beispiel #1
0
 protected override void VisitConditional(ConditionalNode node)
 {
     _isInsideCondition = true;
     Visit(node.ConditionNode);
     _isInsideCondition = false;
     Visit(node.BodyNodes);
 }
Beispiel #2
0
        public override ASTNode VisitIfBlockStatement([NotNull] DaedalusParser.IfBlockStatementContext context)
        {
            ConditionalNode        conditionalNode   = (ConditionalNode)VisitIfBlock(context.ifBlock());
            List <ConditionalNode> conditionalNodes  = new List <ConditionalNode>();
            List <StatementNode>   elseNodeBodyNodes = null;

            foreach (DaedalusParser.ElseIfBlockContext elseIfBlockContext in context.elseIfBlock())
            {
                conditionalNodes.Add((ConditionalNode)VisitElseIfBlock(elseIfBlockContext));
            }

            if (context.elseBlock() != null)
            {
                elseNodeBodyNodes = GetStatementNodes(context.elseBlock().statementBlock());
            }

            return(new IfStatementNode(GetLocation(context), conditionalNode, conditionalNodes, elseNodeBodyNodes));
        }
        public IfStatementNode(NodeLocation location, ConditionalNode ifNode,
                               List <ConditionalNode> elseIfNodes, List <StatementNode> elseNodeBodyNodes) : base(location)
        {
            ifNode.ParentNode = this;
            foreach (var node in elseIfNodes)
            {
                node.ParentNode = this;
            }

            if (elseNodeBodyNodes != null)
            {
                foreach (var node in elseNodeBodyNodes)
                {
                    node.ParentNode = this;
                }
            }

            IfNode            = ifNode;
            ElseIfNodes       = elseIfNodes;
            ElseNodeBodyNodes = elseNodeBodyNodes;
        }
Beispiel #4
0
 protected virtual T VisitConditional(ConditionalNode node)
 {
     Visit(node.ConditionNode);
     Visit(node.BodyNodes);
     return(DefaultResult);
 }
 protected virtual void VisitConditional(ConditionalNode node)
 {
     Visit(node.ConditionNode);
     Visit(node.BodyNodes);
 }
 protected override void VisitConditional(ConditionalNode node)
 {
     CheckStatementsForSingleExpressionHack(node.BodyNodes);
     base.VisitConditional(node);
 }