public PrinterNode Visit(IfNode node) { var pNode = new PrinterNode("If"); pNode.AddChild(node.Condition.Accept(this)); if (node.TrueBranch != null) { pNode.AddChild(node.TrueBranch.Accept(this)); } if (node.FalseBranch != null) { pNode.AddChild(node.FalseBranch.Accept(this)); } return(pNode); }
public void VisitIfNode(IfNode node) { ExpressionNode condition = node.Condition; StatementNode ifBranch = node.IfBranch; StatementNode elseBranch = node.ElseBranch; condition.Accept(this); ifBranch.Accept(this); if (condition.EvaluationType != TokenType.BOOLEAN_VAL) { analyzer.notifyError(new IllegalTypeError(condition)); } if (elseBranch != null) { elseBranch.Accept(this); if (ifBranch.Returns && elseBranch.Returns) { node.Returns = true; } } }
public bool Visit(IfNode node) { node.Condition.Accept(this); _typeChecker.RequireCast(_stack.SymBool, ref node.Condition); return(true); }
public void VisitIfNode(IfNode node) { }