feat(minifier): fold complicated array literals passed to unary +#8944
Merged
graphite-app[bot] merged 1 commit intomainfrom Feb 7, 2025
Conversation
This was referenced Feb 7, 2025
Member
Author
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Performance ReportMerging #8944 will not alter performanceComparing Summary
|
d744f22 to
93a3d46
Compare
This was referenced Feb 7, 2025
Contributor
Merge activity
|
2b20341 to
6357a2b
Compare
graphite-app bot
pushed a commit
that referenced
this pull request
Feb 7, 2025
…8944) Array literals never have `Symbol.toPrimitive` / `toString` / `valueOf` overriden (assuming the prototype is not modified). So for array literals `Array::toString` is used for `ToPrimitive`. `Array::toString` calls `Array::join`. If there's only one element, `Array::join` returns the stringified first element. If there's more than one element, the return value of it always contains `,` . **References** - [Spec of unary `+`](https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#sec-unary-plus-operator-runtime-semantics-evaluation) - [Spec of `ToPrimitive`](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-toprimitive) - [Spec of `Array::toString`](https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.tostring) - [Spec of `Array::join`](https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.join)
93a3d46 to
cdc62a0
Compare
sapphi-red
added a commit
that referenced
this pull request
Feb 7, 2025
…8944) Array literals never have `Symbol.toPrimitive` / `toString` / `valueOf` overriden (assuming the prototype is not modified). So for array literals `Array::toString` is used for `ToPrimitive`. `Array::toString` calls `Array::join`. If there's only one element, `Array::join` returns the stringified first element. If there's more than one element, the return value of it always contains `,` . **References** - [Spec of unary `+`](https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#sec-unary-plus-operator-runtime-semantics-evaluation) - [Spec of `ToPrimitive`](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-toprimitive) - [Spec of `Array::toString`](https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.tostring) - [Spec of `Array::join`](https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.join)
cdc62a0 to
c280d23
Compare
6357a2b to
7ec8a28
Compare
…8944) Array literals never have `Symbol.toPrimitive` / `toString` / `valueOf` overriden (assuming the prototype is not modified). So for array literals `Array::toString` is used for `ToPrimitive`. `Array::toString` calls `Array::join`. If there's only one element, `Array::join` returns the stringified first element. If there's more than one element, the return value of it always contains `,` . **References** - [Spec of unary `+`](https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#sec-unary-plus-operator-runtime-semantics-evaluation) - [Spec of `ToPrimitive`](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-toprimitive) - [Spec of `Array::toString`](https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.tostring) - [Spec of `Array::join`](https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.join)
7ec8a28 to
14462be
Compare
c280d23 to
56575b2
Compare
Base automatically changed from
02-06-feat_minifier_fold_simple_literals_passed_to_unary_
to
main
February 7, 2025 15:42
Dunqing
pushed a commit
that referenced
this pull request
Feb 10, 2025
…8944) Array literals never have `Symbol.toPrimitive` / `toString` / `valueOf` overriden (assuming the prototype is not modified). So for array literals `Array::toString` is used for `ToPrimitive`. `Array::toString` calls `Array::join`. If there's only one element, `Array::join` returns the stringified first element. If there's more than one element, the return value of it always contains `,` . **References** - [Spec of unary `+`](https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#sec-unary-plus-operator-runtime-semantics-evaluation) - [Spec of `ToPrimitive`](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-toprimitive) - [Spec of `Array::toString`](https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.tostring) - [Spec of `Array::join`](https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.join)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Array literals never have
Symbol.toPrimitive/toString/valueOfoverriden (assuming the prototype is not modified).So for array literals
Array::toStringis used forToPrimitive.Array::toStringcallsArray::join.If there's only one element,
Array::joinreturns the stringified first element. If there's more than one element, the return value of it always contains,.References
+ToPrimitiveArray::toStringArray::join