-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into gh-4098-fix-inline-dynamic-issue
- Loading branch information
Showing
5 changed files
with
136 additions
and
28 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
3 changes: 3 additions & 0 deletions
3
test/form/samples/builtin-prototypes/side-effect-free-array-expression/_config.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
description: 'Tree-shakes side-effect-free array functions if only their return value is unused' | ||
}; |
41 changes: 41 additions & 0 deletions
41
test/form/samples/builtin-prototypes/side-effect-free-array-expression/_expected.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const foo1 = [1, 2, 3]; | ||
console.log(foo1[0]); | ||
|
||
const foo2 = [1, 2, 3]; | ||
console.log(foo2[0]); | ||
|
||
const foo3 = [1, 2, 3]; | ||
console.log(foo3[0]); | ||
|
||
const foo4 = [1, 2, 3]; | ||
console.log(foo4[0]); | ||
|
||
const foo5 = [1, 2, 3]; | ||
console.log(foo5[0]); | ||
|
||
const foo6 = [1, 2, 3]; | ||
console.log(foo6[0]); | ||
|
||
const foo7 = [1, 2, 3]; | ||
console.log(foo7[0]); | ||
|
||
const foo8 = [1, 2, 3]; | ||
console.log(foo8[0]); | ||
|
||
const foo9 = [1, 2, 3]; | ||
console.log(foo9[0]); | ||
|
||
const foo10 = [1, 2, 3]; | ||
console.log(foo10[0]); | ||
|
||
const foo11 = [1, 2, 3]; | ||
console.log(foo11[0]); | ||
|
||
const foo12 = [1, 2, 3]; | ||
console.log(foo12[0]); | ||
|
||
const foo13 = [1, 2, 3]; | ||
console.log(foo13[0]); | ||
|
||
const foo14 = [1, 2, 3]; | ||
console.log(foo14[0]); |
55 changes: 55 additions & 0 deletions
55
test/form/samples/builtin-prototypes/side-effect-free-array-expression/main.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const foo1 = [1, 2, 3]; | ||
foo1.at(0); | ||
console.log(foo1[0]); | ||
|
||
const foo2 = [1, 2, 3]; | ||
foo2.concat([0]); | ||
console.log(foo2[0]); | ||
|
||
const foo3 = [1, 2, 3]; | ||
foo3.entries(); | ||
console.log(foo3[0]); | ||
|
||
const foo4 = [1, 2, 3]; | ||
foo4.every(v => v); | ||
console.log(foo4[0]); | ||
|
||
const foo5 = [1, 2, 3]; | ||
foo5.filter(v => v % 1 === 0); | ||
console.log(foo5[0]); | ||
|
||
const foo6 = [1, 2, 3]; | ||
foo6.find(v => v); | ||
console.log(foo6[0]); | ||
|
||
const foo7 = [1, 2, 3]; | ||
foo7.findIndex(v => v); | ||
console.log(foo7[0]); | ||
|
||
const foo8 = [1, 2, 3]; | ||
foo8.forEach(() => {}); | ||
console.log(foo8[0]); | ||
|
||
const foo9 = [1, 2, 3]; | ||
foo9.map(v => v); | ||
console.log(foo9[0]); | ||
|
||
const foo10 = [1, 2, 3]; | ||
foo10.reduce((a, v) => a + v, 0); | ||
console.log(foo10[0]); | ||
|
||
const foo11 = [1, 2, 3]; | ||
foo11.reduceRight((a, v) => a + v, 0); | ||
console.log(foo11[0]); | ||
|
||
const foo12 = [1, 2, 3]; | ||
foo12.slice(1); | ||
console.log(foo12[0]); | ||
|
||
const foo13 = [1, 2, 3]; | ||
foo13.some(v => v); | ||
console.log(foo13[0]); | ||
|
||
const foo14 = [1, 2, 3]; | ||
foo14.values(); | ||
console.log(foo14[0]); |