Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't resolve shadowed
arguments
variables from functions (#14036)
- Loading branch information
1 parent
dfcfbf3
commit add64e8
Showing
6 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...in-transform-arrow-functions/test/fixtures/arrow-functions/arguments-global-var/output.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
11 changes: 11 additions & 0 deletions
11
...in-transform-arrow-functions/test/fixtures/arrow-functions/implicit-var-arguments/exec.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,11 @@ | ||
var arguments = [1, 2, 3]; | ||
var arr = () => arguments[0]; | ||
|
||
expect(arr()).toStrictEqual(1) | ||
|
||
function foo(n) { | ||
var f = () => arguments[0] + n; // foo's implicit arguments binding. arguments[0] is n | ||
return f(); | ||
} | ||
|
||
expect(foo(3)).toStrictEqual(6) |
10 changes: 10 additions & 0 deletions
10
...n-transform-arrow-functions/test/fixtures/arrow-functions/implicit-var-arguments/input.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 @@ | ||
var arguments = [1, 2, 3]; | ||
var arr = (n) => arguments[0]; | ||
|
||
arr(4); // 1 | ||
|
||
function foo(n) { | ||
var f = () => arguments[0] + n; // foo's implicit arguments binding. arguments[0] is n | ||
return f(); | ||
} | ||
|
4 changes: 4 additions & 0 deletions
4
...ansform-arrow-functions/test/fixtures/arrow-functions/implicit-var-arguments/options.json
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,4 @@ | ||
{ | ||
"sourceType": "script", | ||
"plugins": ["transform-arrow-functions"] | ||
} |
18 changes: 18 additions & 0 deletions
18
...-transform-arrow-functions/test/fixtures/arrow-functions/implicit-var-arguments/output.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,18 @@ | ||
var _arguments = [1, 2, 3]; | ||
|
||
var arr = function (n) { | ||
return _arguments[0]; | ||
}; | ||
|
||
arr(4); // 1 | ||
|
||
function foo(n) { | ||
var _arguments2 = arguments; | ||
|
||
var f = function () { | ||
return _arguments2[0] + n; | ||
}; // foo's implicit arguments binding. arguments[0] is n | ||
|
||
|
||
return f(); | ||
} |
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