public ForNode(AssignNode initial, DirectionType direction, ExprNode final, StatementNode body) { Initial = initial; Direction = direction; Final = final; Body = body; }
public PrinterNode Visit(AssignNode node) { var pNode = new PrinterNode(node.Operation.StringValue); pNode.AddChild(node.Left.Accept(this)); pNode.AddChild(node.Right.Accept(this)); return(pNode); }
public bool Visit(AssignNode node) { node.Left.Accept(this); node.Right.Accept(this); if (!node.Left.IsLvalue) { throw BuildException <NotLvalueException>(ExprNode.GetClosestToken(node.Left)); } _typeChecker.RequireAssignment(ref node.Left, ref node.Right, node.Operation); return(true); }
/// <summary> /// Checks the static semantic constraints of an AssignNode. /// </summary> /// <returns>An void.</returns> /// <param name="node">Node.</param> public void VisitAssignNode(AssignNode node) { node.IDNode.Accept(this); node.AssignValueExpression.Accept(this); bool errored = false; TokenType varEval = node.IDNode.EvaluationType; TokenType exprEval = node.AssignValueExpression.EvaluationType; bool assignable = node.IDNode.EvaluationType != TokenType.ERROR; Property varProperty = node.Scope.GetProperty(node.IDNode.IDNode.ID); if (varProperty.DeclarationRow > node.Token.Row) { analyzer.notifyError(new UndeclaredVariableError(node.IDNode)); assignable = false; errored = true; } if (!LegitOperationChecker.isAssignCompatible(varEval, exprEval) && !errored) { analyzer.notifyError(new IllegalAssignmentError(node)); assignable = false; errored = true; } if (!LegitOperationChecker.CanBeAssignedTo(varEval, exprEval) && !errored) { analyzer.notifyError(new IllegalAssignmentError(node)); assignable = false; errored = true; } if (assignable) { varProperty.Assigned = true; } }
public void VisitAssignNode(AssignNode node) { }