New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't resolve shadowed arguments
variables from functions
#14036
Changes from 1 commit
64ead16
872f92b
e497e07
0650f73
1e2f19b
7094515
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var arguments = [1, 2, 3]; | ||
var arr = () => arguments[0]; | ||
|
||
arr(); // 1 | ||
The-x-Theorist marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
function foo(n) { | ||
var f = () => arguments[0] + n; // foo's implicit arguments binding. arguments[0] is n | ||
return f(); | ||
} | ||
|
||
expect(foo(3)).toStrictEqual(6) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
var arguments = [1, 2, 3]; | ||
var arr = () => arguments[0]; | ||
|
||
arr(); // 1 | ||
|
||
function foo(n) { | ||
var f = () => arguments[0] + n; // foo's implicit arguments binding. arguments[0] is n | ||
return f(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"sourceType": "unambiguous", | ||
"presets": ["env"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Babel 8 tests are failing because you didn't specify any target here. Could you move this test in the arrow functions plugin, and enable the plugin instead of the preset? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I can do that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed the same as you said. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var _arguments = typeof arguments === "undefined" ? void 0 : arguments; | ||
|
||
var arguments = [1, 2, 3]; | ||
|
||
var arr = function arr() { | ||
return _arguments[0]; | ||
The-x-Theorist marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
arr(); // 1 | ||
|
||
function foo(n) { | ||
var _arguments2 = arguments; | ||
|
||
var f = function f() { | ||
return _arguments2[0] + n; | ||
}; // foo's implicit arguments binding. arguments[0] is n | ||
|
||
|
||
return f(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for self and others: this is correct, the test was previously broken —
fn
should not see the outerarguments
, because it was not an arrow function in input.js