Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c89226a
commit 71f83c3
Showing
11 changed files
with
213 additions
and
91 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
5 changes: 5 additions & 0 deletions
5
test/form/samples/builtin-prototypes/template-literal/_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
6 changes: 6 additions & 0 deletions
6
test/form/samples/builtin-prototypes/template-literal/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
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,22 @@ | ||
const assert = require('assert'); | ||
|
||
module.exports = { | ||
description: 'does not remove calls to props without value', | ||
minNodeVersion: 12, | ||
exports({ callProp, callStaticProp }) { | ||
let hasError = false; | ||
try { | ||
callStaticProp(); | ||
} catch { | ||
hasError = true; | ||
} | ||
assert.ok(hasError); | ||
hasError = false; | ||
try { | ||
callProp(); | ||
} catch { | ||
hasError = true; | ||
} | ||
assert.ok(hasError); | ||
} | ||
}; |
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,11 @@ | ||
class Foo { | ||
static staticProp; | ||
prop; | ||
} | ||
|
||
export const callStaticProp = () => Foo.staticProp() || false; | ||
|
||
export const callProp = () => { | ||
const foo = new Foo(); | ||
return foo.prop() || 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
46 changes: 32 additions & 14 deletions
46
test/function/samples/conditionals-deoptimization/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 |
---|---|---|
@@ -1,21 +1,39 @@ | ||
export let first = false; | ||
export let second = false; | ||
export let third = false; | ||
export let fourth = false; | ||
export let cond1a = false; | ||
export let cond1b = false; | ||
export let cond2a = false; | ||
export let cond2b = false; | ||
export let log1a = false; | ||
export let log1b = false; | ||
export let log2a = false; | ||
export let log2b = false; | ||
|
||
let flag = false; | ||
checkConditional(); | ||
checkLogical(); | ||
checkConditional1(); | ||
checkConditional2(); | ||
checkLogical1(); | ||
checkLogical2(); | ||
flag = true; | ||
checkConditional(); | ||
checkLogical(); | ||
checkConditional1(); | ||
checkConditional2(); | ||
checkLogical1(); | ||
checkLogical2(); | ||
|
||
function checkConditional() { | ||
if (flag ? true : false) first = true; | ||
else second = true; | ||
function checkConditional1() { | ||
if (flag ? true : false) cond1a = true; | ||
else cond1b = true; | ||
} | ||
|
||
function checkLogical() { | ||
if (flag && true) third = true; | ||
else fourth = true; | ||
function checkConditional2() { | ||
if (!flag ? true : false) cond2a = true; | ||
else cond2b = true; | ||
} | ||
|
||
function checkLogical1() { | ||
if (flag && true) log1a = true; | ||
else log1b = true; | ||
} | ||
|
||
function checkLogical2() { | ||
if (!flag && true) log2a = true; | ||
else log2b = true; | ||
} |
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: 'deoptimizes getting return expression for long property paths' | ||
}; |
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,27 @@ | ||
let effect = false; | ||
const obj = { | ||
a: { | ||
b: { | ||
c: { | ||
d: { | ||
e: { | ||
f: { | ||
g: { | ||
h: { | ||
i: { | ||
j: { | ||
k: () => ({ effect: () => (effect = true) }) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
obj.a.b.c.d.e.f.g.h.i.j.k().effect(); | ||
assert.ok(effect); |