forked from babel/babel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce
transform-block-scoping
loops output size (babel#15746)
Co-authored-by: Nicolò Ribaudo <[email protected]>
- Loading branch information
1 parent
11844c1
commit b798a69
Showing
20 changed files
with
451 additions
and
182 deletions.
There are no files selected for viewing
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
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
36 changes: 18 additions & 18 deletions
36
...gin-transform-block-scoping/test/fixtures/general/closure-in-generator-or-async/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
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
35 changes: 18 additions & 17 deletions
35
...-plugin-transform-block-scoping/test/fixtures/general/for-break-continue-return/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 |
---|---|---|
@@ -1,22 +1,23 @@ | ||
(function () { | ||
var _loop = function (i) { | ||
fns.push(function () { | ||
return i; | ||
}); | ||
if (i === 1) { | ||
return "continue"; | ||
} else if (i === 2) { | ||
return "break"; | ||
} else if (i === 3) { | ||
return { | ||
v: i | ||
}; | ||
} | ||
}; | ||
fns.push(function () { | ||
return i; | ||
}); | ||
if (i === 1) { | ||
return 0; // continue | ||
} else if (i === 2) { | ||
return 1; // break | ||
} else if (i === 3) { | ||
return { | ||
v: i | ||
}; | ||
} | ||
}, | ||
_ret; | ||
for (var i in nums) { | ||
var _ret = _loop(i); | ||
if (_ret === "continue") continue; | ||
if (_ret === "break") break; | ||
if (typeof _ret === "object") return _ret.v; | ||
_ret = _loop(i); | ||
if (_ret === 0) continue; | ||
if (_ret === 1) break; | ||
if (_ret) return _ret.v; | ||
} | ||
})(); |
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
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
19 changes: 10 additions & 9 deletions
19
...babel-plugin-transform-block-scoping/test/fixtures/general/for-return-undefined/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 |
---|---|---|
@@ -1,14 +1,15 @@ | ||
(function () { | ||
var _loop = function (i) { | ||
fns.push(function () { | ||
return i; | ||
}); | ||
return { | ||
v: void 0 | ||
}; | ||
}; | ||
fns.push(function () { | ||
return i; | ||
}); | ||
return { | ||
v: void 0 | ||
}; | ||
}, | ||
_ret; | ||
for (var i in nums) { | ||
var _ret = _loop(i); | ||
if (typeof _ret === "object") return _ret.v; | ||
_ret = _loop(i); | ||
if (_ret) return _ret.v; | ||
} | ||
})(); |
19 changes: 10 additions & 9 deletions
19
packages/babel-plugin-transform-block-scoping/test/fixtures/general/for-return/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 |
---|---|---|
@@ -1,14 +1,15 @@ | ||
(function () { | ||
var _loop = function (i) { | ||
fns.push(function () { | ||
return i; | ||
}); | ||
return { | ||
v: i | ||
}; | ||
}; | ||
fns.push(function () { | ||
return i; | ||
}); | ||
return { | ||
v: i | ||
}; | ||
}, | ||
_ret; | ||
for (var i in nums) { | ||
var _ret = _loop(i); | ||
if (typeof _ret === "object") return _ret.v; | ||
_ret = _loop(i); | ||
if (_ret) return _ret.v; | ||
} | ||
})(); |
Oops, something went wrong.