Files
liuxingbaoyuandGitHub f431e0cc85 Fix hoisting of function declarations in loops and switch (#17691)
* fix

* fix switch

* Revert "Fix order of `transform-block-scoped-functions` in `preset-env` (#16475)"

This reverts commit 15a3342b39.

* clean

* fix test

* use enter

* fix
2026-01-23 18:36:41 +01:00

39 lines
713 B
JavaScript

function WithoutCurlyBraces() {
var _this = this;
if (true) {
var _loop = function () {
foo = function () {
return this;
};
bar = function () {
return foo.call(this);
};
console.log(_this, k); // => undefined
},
foo,
bar;
for (var k in kv) {
_loop();
}
}
}
function WithCurlyBraces() {
var _this2 = this;
if (true) {
var _loop2 = function () {
foo = function () {
return this;
};
bar = function () {
return foo.call(this);
};
console.log(_this2, k); // => 777
},
foo,
bar;
for (var k in kv) {
_loop2();
}
}
}