Merge pull request #3455 from weswigham/asyncFunctions

Emit awaiter arguments on new line
This commit is contained in:
Ron Buckton
2015-06-10 12:35:14 -07:00
29 changed files with 63 additions and 31 deletions
+3 -1
View File
@@ -3441,7 +3441,9 @@ var __awaiter = (this && this.__awaiter) || function (generator, thisArg, args,
emitFunctionBody(node);
// Emit the current `this` binding.
write(", this");
write(",");
writeLine();
write("this");
// Optionally emit the lexical arguments.
if (hasLexicalArguments) {
@@ -5,4 +5,5 @@ var foo = async (): Promise<void> => {
//// [asyncArrowFunction1_es6.js]
var foo = () => __awaiter(function* () {
}, this, void 0, Promise);
},
this, void 0, Promise);
@@ -5,4 +5,5 @@ var foo = async (a = await): Promise<void> => {
//// [asyncArrowFunction6_es6.js]
var foo = (a = await) => __awaiter(function* () {
}, this, void 0, Promise);
},
this, void 0, Promise);
@@ -10,5 +10,7 @@ var bar = async (): Promise<void> => {
var bar = () => __awaiter(function* () {
// 'await' here is an identifier, and not an await expression.
var foo = (a = await) => __awaiter(function* () {
}, this, void 0, Promise);
}, this, void 0, Promise);
},
this, void 0, Promise);
},
this, void 0, Promise);
@@ -7,4 +7,5 @@ var foo = async (): Promise<void> => {
//// [asyncArrowFunction8_es6.js]
var foo = () => __awaiter(function* () {
var v = { [yield ]: foo };
}, this, void 0, Promise);
},
this, void 0, Promise);
@@ -4,4 +4,5 @@ var foo = async (a = await => await): Promise<void> => {
//// [asyncArrowFunction9_es6.js]
var foo = (a = await => await) => __awaiter(function* () {
}, this, void 0, Promise);
},
this, void 0, Promise);
@@ -11,6 +11,7 @@ class C {
class C {
method() {
function other() { }
var fn = () => __awaiter(function* (arguments) { return yield other.apply(this, arguments); }, this, arguments);
var fn = () => __awaiter(function* (arguments) { return yield other.apply(this, arguments); },
this, arguments);
}
}
@@ -9,6 +9,7 @@ class C {
//// [asyncArrowFunctionCapturesThis_es6.js]
class C {
method() {
var fn = () => __awaiter(function* () { return yield this; }, this);
var fn = () => __awaiter(function* () { return yield this; },
this);
}
}
@@ -5,5 +5,6 @@ async function foo(a = await => await): Promise<void> {
//// [asyncFunctionDeclaration10_es6.js]
function foo(a = await => await) {
return __awaiter(function* () {
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -5,5 +5,6 @@ async function await(): Promise<void> {
//// [asyncFunctionDeclaration11_es6.js]
function await() {
return __awaiter(function* () {
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -10,5 +10,6 @@ function foo() {
return __awaiter(function* () {
// Legal to use 'await' in a type context.
var v;
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -7,5 +7,6 @@ async function foo(): Promise<void> {
function foo() {
return __awaiter(function* () {
return;
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -5,5 +5,6 @@ async function foo(): Promise<void> {
//// [asyncFunctionDeclaration1_es6.js]
function foo() {
return __awaiter(function* () {
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -5,5 +5,6 @@ async function foo(a = await): Promise<void> {
//// [asyncFunctionDeclaration6_es6.js]
function foo(a = await) {
return __awaiter(function* () {
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -11,7 +11,9 @@ function bar() {
// 'await' here is an identifier, and not a yield expression.
function foo(a = await) {
return __awaiter(function* () {
}, this, void 0, Promise);
},
this, void 0, Promise);
}
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -7,5 +7,6 @@ async function foo(): Promise<void> {
function foo() {
return __awaiter(function* () {
var v = { [yield ]: foo };
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -13,5 +13,6 @@ function func() {
"before";
var b = (yield p) || a;
"after";
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -13,5 +13,6 @@ function func() {
"before";
var b = (yield p) && a;
"after";
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -13,5 +13,6 @@ function func() {
"before";
var b = (yield p) + a;
"after";
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -13,5 +13,6 @@ function func() {
"before";
var b = yield p, a;
"after";
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -15,5 +15,6 @@ function func() {
var o;
o.a = yield p;
"after";
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -17,5 +17,6 @@ function func() {
"before";
var b = fn(a, a, a);
"after";
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -17,5 +17,6 @@ function func() {
"before";
var b = fn(yield p, a, a);
"after";
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -17,5 +17,6 @@ function func() {
"before";
var b = fn(a, yield p, a);
"after";
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -17,5 +17,6 @@ function func() {
"before";
var b = (yield pfn)(a, a, a);
"after";
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -17,5 +17,6 @@ function func() {
"before";
var b = o.fn(a, a, a);
"after";
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -17,5 +17,6 @@ function func() {
"before";
var b = o.fn(yield p, a, a);
"after";
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -17,5 +17,6 @@ function func() {
"before";
var b = o.fn(a, yield p, a);
"after";
}, this, void 0, Promise);
},
this, void 0, Promise);
}
@@ -17,5 +17,6 @@ function func() {
"before";
var b = (yield po).fn(a, a, a);
"after";
}, this, void 0, Promise);
},
this, void 0, Promise);
}