public void Print(OutputContext output, bool forceParens = false) { output.PushNode(this); if (this is AstToplevel) { output.AddMapping(null, new Position(), true); } else { output.AddMapping(Source, Start, true); } if (forceParens || NeedParens(output)) { output.Print("("); CodeGen(output); output.Print(")"); } else { CodeGen(output); } output.PopNode(); }
public override void CodeGen(OutputContext output) { Expression.Print(output); if (this is AstNew && !output.NeedConstructorParens(this)) { return; } if (Expression is AstCall or AstLambda) { output.AddMapping(Expression.Source, Start, false); } if (Optional) { output.Print("?."); } output.Print("("); for (var i = 0u; i < Args.Count; i++) { if (i > 0) { output.Comma(); } Args[i].Print(output); } output.Print(")"); }
public override void CodeGen(OutputContext output) { Expression.Print(output, Expression is AstBinary && output.NeedNodeParens(Expression)); if (output.NeedDotAfterNumber()) { output.Print("."); } output.AddMapping(Expression.Source, Expression.End, false); output.Print("."); output.Print((string)Property); }
public override void CodeGen(OutputContext output) { Expression.Print(output); if (output.NeedDotAfterNumber()) { output.Print("."); } output.Print("."); // the name after dot would be mapped about here. output.AddMapping(End); output.Print((string)Property); }
public void Print(OutputContext output, bool forceParens = false) { output.PushNode(this); output.AddMapping(Source, Start, true); if (forceParens || !output.HasParens() && NeedParens(output)) { output.Print("("); CodeGen(output); output.Print(")"); } else { CodeGen(output); } output.PopNode(); }