-
Notifications
You must be signed in to change notification settings - Fork 49.1k
feat(compiler): Implement constant string concat propagation #29621
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Comparing: 6f23540...cb4a4e4 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
compiler/crates/react_hermes_parser/tests/fixtures/constant-propagation-string-concat.js
Outdated
Show resolved
Hide resolved
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.
The changes look good, let's just revert the changes under compiler/crates/
6518372
to
ca54a0e
Compare
ca54a0e
to
cb4a4e4
Compare
I was wondering about the cases where one of the operands is string and the other is number: case "+": {
if ((typeof lhs === "number" || typeof lhs === "string")) && (typeof rhs === "number" || typeof rhs === "string")) {
result = { kind: "Primitive", value: lhs + rhs, loc: value.loc };
}
break;
} |
We'd have to double-check the spec for "+" with string and numbers. Let's start with just number+number and string+string. |
What about string+number or num+string |
Summary
Resolves #29617
How did you test this change?
I verified the implementation using the test.