void ASTVisitor.Accept(NodeWhen value) { Accept(value); }
internal void Accept(NodeWhen when) { var condition = when.condition; when.pass.isResultRequired = when.isResultRequired; when.pass.inTailPosition = when.inTailPosition; when.fail.isResultRequired = when.isResultRequired; when.fail.inTailPosition = when.inTailPosition; // Disable scopes, we'll do them ourselves if (when.pass is NodeBlock) (when.pass as NodeBlock).createScope = false; if (when.fail is NodeBlock) (when.fail as NodeBlock).createScope = false; builder.StartScope(); uint failLoc; /* if (condition is NodeInfix && (condition as NodeInfix).op == "==") { } else if (condition is NodeInfix && (condition as NodeInfix).op == "!=") { } else // */ { condition.Visit(this); failLoc = builder.OpJumpF(0); } when.pass.Visit(this); uint passLoc = builder.OpJump(0); builder.SetOpC(failLoc, builder.InsnCount); when.fail.Visit(this); builder.SetOpC(passLoc, builder.InsnCount); builder.EndScope(); }
private Node ParseWhen(Node pass) { var when = new NodeWhen(Location); when.pass = pass; Advance(); // 'when' if (!TokensRemain) { log.Error(when.location, "Expected expression for 'when' condition, but the end of the file was reached."); return when; } when.condition = Expression(); Expect(EL, "Expected 'el' to complete when expression."); if (!TokensRemain) { log.Error(when.location, "Expected expression for 'when' fail expression, but the end of the file was reached."); return when; } when.fail = Expression(); return when; }