Guest User

Untitled

a guest
Dec 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. // parse.d parseInterpolatedString
  2. auto exp = new AST.TupleExp(token.loc, parts);
  3. AST.Expression e = new AST.IdentifierExp(exp.loc, Id.empty);
  4. e = new AST.DotIdExp(exp.loc, e, Id.object);
  5. e = new AST.DotIdExp(exp.loc, e, Identifier.idPool("_interpolation"));
  6. return new AST.CallExp(exp.loc, e, exp);
  7.  
  8. // object.d
  9. struct Interpolation(T...) {
  10.  
  11. immutable T args;
  12.  
  13. private this()(auto ref T args) { this.args = args; }
  14. @disable this(this);
  15.  
  16. string toString() { return from!q{std.conv}.text(args); }
  17. alias toString this;
  18.  
  19. }
  20.  
  21. auto _interpolation(T...)(auto ref T args)
  22. if (T.length > 0) { return Interpolation!T(args); }
Add Comment
Please, Sign In to add comment