Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent ASI errors for logical and sequence expressions, also check
for throw statements
- Loading branch information
1 parent
1059e99
commit 808d2da
Showing
9 changed files
with
78 additions
and
25 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
const assert = require('assert'); | ||
|
||
module.exports = { | ||
description: 'prevent automatic semicolon insertion from changing behaviour when tree-shaking', | ||
exports(exports) { | ||
assert.strictEqual(exports.test1(), 'expected'); | ||
assert.strictEqual(exports.test2(), 'expected'); | ||
options: { | ||
treeshake: { tryCatchDeoptimization: false } | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,15 +1,42 @@ | ||
export function test1() { | ||
function test1() { | ||
return true ? | ||
|
||
/* kept */ | ||
|
||
'expected' : | ||
'unexpected'; | ||
} | ||
assert.strictEqual(test1(), 'expected'); | ||
|
||
export function test2() { | ||
function test2() { | ||
return false ? | ||
'unexpected' : | ||
/* kept */ | ||
|
||
'expected'; | ||
} | ||
assert.strictEqual(test2(), 'expected'); | ||
|
||
function test3() { | ||
return true && | ||
/* kept */ | ||
|
||
'expected'; | ||
} | ||
assert.strictEqual(test3(), 'expected'); | ||
|
||
function test4() { | ||
return 'removed', | ||
/* kept */ | ||
|
||
'expected'; | ||
} | ||
assert.strictEqual(test4(), 'expected'); | ||
|
||
try { | ||
throw true ? | ||
|
||
new Error('expected') : | ||
null; | ||
} catch (err) { | ||
assert.strictEqual(err.message, 'expected'); | ||
} |