-
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: minify infinity in expressions (#841)
* fix: minify infinity in expressions * fix object expressions transformations * address review comments
- Loading branch information
1 parent
9939bca
commit 18dcfe1
Showing
5 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
packages/babel-plugin-minify-infinity/__tests__/fixtures/bindings/actual.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,12 @@ | ||
function foo() { | ||
let [Infinity] = some(); | ||
return Infinity; | ||
} | ||
|
||
function bar() { | ||
let [...Infinity] = some(); | ||
} | ||
|
||
function baz() { | ||
let { inf = Infinity } = some(); | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/babel-plugin-minify-infinity/__tests__/fixtures/bindings/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,14 @@ | ||
function foo() { | ||
let [Infinity] = some(); | ||
return Infinity; | ||
} | ||
|
||
function bar() { | ||
let [...Infinity] = some(); | ||
} | ||
|
||
function baz() { | ||
let { | ||
inf = 1 / 0 | ||
} = some(); | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/babel-plugin-minify-infinity/__tests__/fixtures/expressions/actual.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,10 @@ | ||
let x = [Infinity, Infinity]; | ||
|
||
let y = [ | ||
{ | ||
a: Infinity | ||
}, | ||
{ | ||
a: Infinity | ||
} | ||
]; |
6 changes: 6 additions & 0 deletions
6
packages/babel-plugin-minify-infinity/__tests__/fixtures/expressions/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,6 @@ | ||
let x = [1 / 0, 1 / 0]; | ||
let y = [{ | ||
a: 1 / 0 | ||
}, { | ||
a: 1 / 0 | ||
}]; |
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