mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Merge pull request #11130 from Microsoft/fix11031
Fix downlevel async hoisting
This commit is contained in:
commit
992b385dfe
@ -573,11 +573,11 @@ namespace ts {
|
||||
operationLocations = undefined;
|
||||
state = createTempVariable(/*recordTempVariable*/ undefined);
|
||||
|
||||
const statementOffset = addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor);
|
||||
|
||||
// Build the generator
|
||||
startLexicalEnvironment();
|
||||
|
||||
const statementOffset = addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor);
|
||||
|
||||
transformAndEmitStatements(body.statements, statementOffset);
|
||||
|
||||
const buildResult = build();
|
||||
@ -615,6 +615,11 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
else {
|
||||
// Do not hoist custom prologues.
|
||||
if (node.emitFlags & NodeEmitFlags.CustomPrologue) {
|
||||
return node;
|
||||
}
|
||||
|
||||
for (const variable of node.declarationList.declarations) {
|
||||
hoistVariableDeclaration(<Identifier>variable.name);
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ var bar = async (): Promise<void> => {
|
||||
//// [asyncArrowFunction7_es5.js]
|
||||
var _this = this;
|
||||
var bar = function () { return __awaiter(_this, void 0, void 0, function () {
|
||||
_this = this;
|
||||
var _this = this;
|
||||
var foo;
|
||||
return __generator(this, function (_a) {
|
||||
foo = function (a) {
|
||||
@ -22,4 +22,4 @@ var bar = function () { return __awaiter(_this, void 0, void 0, function () {
|
||||
};
|
||||
return [2 /*return*/];
|
||||
});
|
||||
}); var _this; };
|
||||
}); };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user