-
-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(minifier): merge assign expression in conditional expression (#8345
) compresses `a ? b = 0 : b = 1` into `b = a ? 0 : 1` This can be done when `b` is an IdentifierReference and the assignment operator is `=`. In this circumstance, the evaluation of `b = a ? 0 : 1` is: 1. Let lref be ? Evaluation of LeftHandSideExpression. (this does not have a side effect when LeftHandSideExpression is an IdentifierReference) 2. Let rref be ? Evaluation of AssignmentExpression. (ConditionalExpression is evaluated here) 3. Let rval be ? GetValue(rref). 4. Perform ? PutValue(lref, rval). 5. Return rval. **References** - [spec of `=`](https://262.ecma-international.org/15.0/index.html#sec-assignment-operators-runtime-semantics-evaluation) - [spec of `? :`](https://262.ecma-international.org/15.0/index.html#sec-conditional-operator-runtime-semantics-evaluation)
- Loading branch information
1 parent
5a648bc
commit 8d52cd0
Showing
3 changed files
with
96 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters