[Bug]: plugin-transform-object-super
incorrect output where object created in a loop
#15945
Closed
1 task
馃捇
How are you using Babel?
Programmatic API (
babel.transform
,babel.parse
)Input code
REPL
Configuration file name
No response
Configuration
No response
Current and expected behavior
In the original code, the assertions pass. When transformed with @babel/plugin-transform-object-super, the first assertion fails.
The transformed output is:
Environment
REPL
Possible solution
The problem is that
_obj
for the 1st turn of the loop is over-written in 2nd turn, because_obj
is not block scoped. Could be solved by changingvar _obj
tolet _obj
.Please see REPL.
Additional context
No response
The text was updated successfully, but these errors were encountered: