-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solves Tagged template literal size optimization #7379
Conversation
debugpai
commented
Feb 14, 2018
•
edited by jridgewell
Loading
edited by jridgewell
Q | A |
---|---|
Fixed Issues? | Fixes #7352 |
Tests Added + Pass? | Yes |
Any Dependency Changes? | no |
License | MIT |
- Adds a check to see if strings and raw strings are equal
- If they are equal doesn't pass raws to call expression
- Modifies taggedTemplateHelpers to slice strings if raws is not passed
4a316c3
to
349a2cf
Compare
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/6887/ |
[ | ||
t.arrayExpression(strings), | ||
!isStringsRawEqual ? t.arrayExpression(raws) : null, | ||
].filter(x => x), |
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.
Let’s hoist out the array and push raws
in inside an if-statement.
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.
Made this change
@@ -0,0 +1 @@ | |||
var foo = tag`wow`; |
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.
Let’s add a multi quasi case:
var bar = tag`first${1}second`;
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.
made this change
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.
@loganfsmyth: would you like to review, too?
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.
Cool! Thanks for your pr
* Tagged template literal size optimization solves babel#7352 * Incorporates review changes