Skip to content
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

Merged
merged 2 commits into from
Feb 20, 2018

Conversation

debugpai
Copy link
Contributor

@debugpai debugpai commented Feb 14, 2018

Q                       A
Fixed Issues? Fixes #7352
Tests Added + Pass? Yes
Any Dependency Changes? no
License MIT
  1. Adds a check to see if strings and raw strings are equal
  2. If they are equal doesn't pass raws to call expression
  3. Modifies taggedTemplateHelpers to slice strings if raws is not passed

@babel-bot
Copy link
Collaborator

babel-bot commented Feb 14, 2018

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),
Copy link
Member

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.

Copy link
Contributor Author

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`;
Copy link
Member

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`;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made this change

@existentialism existentialism added the PR: Polish 💅 A type of pull request used for our changelog categories label Feb 14, 2018
Copy link
Member

@jridgewell jridgewell left a 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?

Copy link
Member

@xtuc xtuc left a 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

@jridgewell jridgewell merged commit dad05ed into babel:master Feb 20, 2018
aminmarashi pushed a commit to aminmarashi/babel that referenced this pull request Mar 17, 2018
* Tagged template literal size optimization
solves babel#7352

* Incorporates review changes
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Polish 💅 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tagged Template Literal: Size Optimization
5 participants