-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
fix: Transform scoping for for X
in loop
#16384
Changes from 1 commit
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,17 @@ | ||
function w() { | ||
for (let i = 0; i < y; i++) { | ||
let outer = {} | ||
for (var key in someObj) { | ||
let x = () => outer; | ||
} | ||
} | ||
} | ||
|
||
function w2() { | ||
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. What is the difference between these two functions? 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. One is 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. Ohh I played the "find the difference between the two pictures" game for like 3 minutes before giving up 😬 |
||
for (let i = 0; i < y; i++) { | ||
let outer = {} | ||
for (var key of someObj) { | ||
let x = () => outer; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
function w() { | ||
var _loop = function () { | ||
var outer = {}; | ||
for (key in someObj) { | ||
var x = function () { | ||
return outer; | ||
}; | ||
} | ||
}, | ||
key; | ||
for (var i = 0; i < y; i++) { | ||
_loop(); | ||
} | ||
} | ||
function w2() { | ||
var _loop2 = function () { | ||
var outer = {}; | ||
for (key of someObj) { | ||
var x = function () { | ||
return outer; | ||
}; | ||
} | ||
}, | ||
key; | ||
for (var i = 0; i < y; i++) { | ||
_loop2(); | ||
} | ||
} |
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.
Can you also add a test swapping the
for ... in
andfor (;;)
loops?