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
5dec01d
commit f8f2fa7
Showing
8 changed files
with
42 additions
and
8 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/function/samples/for-in-loop-head-dependencies/_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: 'uses parent scope for right-hand-side in for-in statement (#1480)' | ||
}; |
12 changes: 12 additions & 0 deletions
12
test/function/samples/for-in-loop-head-dependencies/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,12 @@ | ||
function foo() { | ||
return ['x']; | ||
} | ||
|
||
const result = []; | ||
|
||
for (let i in foo()) { | ||
const foo = i; | ||
result.push(foo); | ||
} | ||
|
||
assert.deepEqual(result, [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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = { | ||
description: 'uses parent scope for right-hand-side in for-in statement (#1480)' | ||
description: 'uses correct scope in for statement (#1538)' | ||
}; |
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,12 +1,12 @@ | ||
function foo() { | ||
return ['x']; | ||
return ['x', 'y']; | ||
} | ||
|
||
const result = []; | ||
|
||
for (let i in foo()) { | ||
const foo = i; | ||
for (let a = foo(), i = 0; i < a.length; ++i) { | ||
const foo = a[i]; | ||
result.push(foo); | ||
} | ||
|
||
assert.deepEqual(result, [0]); | ||
assert.deepEqual(result, ['x', 'y']); |
3 changes: 3 additions & 0 deletions
3
test/function/samples/for-of-loop-head-dependencies/_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: 'uses parent scope for right-hand-side in for-of statement (#1539)' | ||
}; |
12 changes: 12 additions & 0 deletions
12
test/function/samples/for-of-loop-head-dependencies/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,12 @@ | ||
function foo() { | ||
return ['x', 'y']; | ||
} | ||
|
||
const result = []; | ||
|
||
for (const i of foo()) { | ||
const foo = i; | ||
result.push(i); | ||
} | ||
|
||
assert.deepEqual(result, ['x', 'y']); |