- Notifications
You must be signed in to change notification settings - Fork2k
[CS2] Output interpolated strings as template literals#4365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[CS2] Output interpolated strings as template literals#4365
Uh oh!
There was an error while loading.Please reload this page.
Conversation
# Uncomment the following line in CoffeeScript 2, to allow all interpolated | ||
# strings to be output using the ES2015 syntax: | ||
# unwrap: -> this | ||
#TODO: Is this needed / correct? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
this is correct. This is needed fortraverseChildren
introspection. If you don't use this,=> "foo #{this}"
will not have itsthis
bound because that one traverseChildren wouldn't have traversed inside the interpolations.
@GeoffreyBooth and@lydell I've made the changes to output interpolated strings as template literals. Am looking for some input, as I'm lacking nodes.coffee knowledge. Specifically, StringWithInterpolations now extends Base, not Parens. Extending Parens is unnecessary, as we don't need to bracket template literals (they have clear backtick begin and end markers). Am looking for guidance on which StringWithInterpolations fields to overload from Base. I copied Parens, which overloaded Relevant lines are below. Thoughts?
|
@lydell and@jashkenas I’ve been wondering about the purpose of |
…ed-strings-as-template-literals
Explaining how that stuff works would be awesome. I struggle with it every time I touch nodes.coffee. |
I think this is roughly what some of them do:
All of the above might be used for more things as well, but that's just what I (think I) remember from the top of my head. |
jashkenas commentedNov 28, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The children listis the structure of the AST. The
Exactly. It's all about "do we need to cache this expression?"
Jumps tells you if an expression, or an internal part of an expression has a flow control construct (like value=if condition100elsereturn5
Exactly. Things that If anyone wants to put any of the above into docs or further comments, feel free. |
@lydell and@jashkenas I merged your comments intohttps://github.com/jashkenas/coffeescript/wiki/%5BHowTo%5D-How-parsing-works |
Uh oh!
There was an error while loading.Please reload this page.
In CS2, output interpolated strings as template literals.
Follow on work from#4352