Merge branch 'transforms' into transforms-generators

This commit is contained in:
Ron Buckton 2016-06-15 11:04:21 -07:00
commit 5e31b25af4
6 changed files with 41 additions and 42 deletions

View File

@ -1575,10 +1575,10 @@ namespace ts {
* @param node The type node.
*/
function getRestParameterElementType(node: TypeNode) {
if (node.kind === SyntaxKind.ArrayType) {
if (node && node.kind === SyntaxKind.ArrayType) {
return (<ArrayTypeNode>node).elementType;
}
else if (node.kind === SyntaxKind.TypeReference) {
else if (node && node.kind === SyntaxKind.TypeReference) {
return singleOrUndefined((<TypeReferenceNode>node).typeArguments);
}
else {
@ -1623,6 +1623,9 @@ namespace ts {
if (isFunctionLike(node) && node.type) {
return serializeTypeNode(node.type);
}
else if (isAsyncFunctionLike(node)) {
return createIdentifier("Promise");
}
return createVoidZero();
}

View File

@ -40,20 +40,20 @@ class A {
baz(n) { return n; }
}
__decorate([
decorator,
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', Promise)
decorator,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], A.prototype, "foo", null);
__decorate([
decorator,
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', Promise)
decorator,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], A.prototype, "bar", null);
__decorate([
decorator,
__metadata('design:type', Function),
__metadata('design:paramtypes', [Promise]),
__metadata('design:returntype', Promise)
decorator,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Promise]),
__metadata("design:returntype", Promise)
], A.prototype, "baz", null);

View File

@ -1,7 +1,7 @@
//// [disallowAsyncModifierInES5.ts]
async function foo() { return 42; } // ERROR: Async functions are only available in ES6+
let bar = async function () { return 42; } // OK, but should be an error
async function foo() { return 42; } // ERROR: Async functions are only available in ES6+
let bar = async function () { return 42; } // OK, but should be an error
let baz = async () => 42; // OK, but should be an error
//// [disallowAsyncModifierInES5.js]
@ -20,4 +20,4 @@ function foo() {
var bar = function () {
return __awaiter(this, void 0, void 0, function* () { return 42; });
}; // OK, but should be an error
var baz = function () { return __awaiter(_this, void 0, void 0, function* () { return 42; }); }; // OK, but should be an error
var baz = function () { return __awaiter(_this, void 0, void 0, function* () { return 42; }); }; // OK, but should be an error

View File

@ -41,18 +41,18 @@ var A = (function () {
args[_i - 0] = arguments[_i];
}
};
__decorate([
MyMethodDecorator,
__metadata('design:type', Function),
__metadata('design:paramtypes', [Object]),
__metadata('design:returntype', void 0)
], A.prototype, "method", null);
A = __decorate([
MyClassDecorator,
__metadata('design:paramtypes', [Object])
], A);
return A;
}());
__decorate([
MyMethodDecorator,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], A.prototype, "method", null);
A = __decorate([
MyClassDecorator,
__metadata("design:paramtypes", [Object])
], A);
var B = (function () {
function B() {
var args = [];
@ -66,15 +66,15 @@ var B = (function () {
args[_i - 0] = arguments[_i];
}
};
__decorate([
MyMethodDecorator,
__metadata('design:type', Function),
__metadata('design:paramtypes', [String]),
__metadata('design:returntype', void 0)
], B.prototype, "method", null);
B = __decorate([
MyClassDecorator,
__metadata('design:paramtypes', [Number])
], B);
return B;
}());
__decorate([
MyMethodDecorator,
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], B.prototype, "method", null);
B = __decorate([
MyClassDecorator,
__metadata("design:paramtypes", [Number])
], B);

View File

@ -2,7 +2,6 @@
"======== Resolving module './mod1' from '/mod2.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
"File '/mod1.ts' exist - use it as a name resolution result.",
"Resolving real path for '/mod1.ts', result '/mod1.ts'",
"======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========",
"======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========",
"Resolving with primary search path '/types'",

View File

@ -2,12 +2,10 @@
"======== Resolving module './main' from '/mod2.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
"File '/main.ts' exist - use it as a name resolution result.",
"Resolving real path for '/main.ts', result '/main.ts'",
"======== Module name './main' was successfully resolved to '/main.ts'. ========",
"======== Resolving module './mod1' from '/mod2.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
"File '/mod1.ts' exist - use it as a name resolution result.",
"Resolving real path for '/mod1.ts', result '/mod1.ts'",
"======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========",
"======== Resolving type reference directive 'lib', containing file '/mod1.ts', root directory '/types'. ========",
"Resolving with primary search path '/types'",
@ -17,7 +15,6 @@
"======== Resolving module './main' from '/mod1.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
"File '/main.ts' exist - use it as a name resolution result.",
"Resolving real path for '/main.ts', result '/main.ts'",
"======== Module name './main' was successfully resolved to '/main.ts'. ========",
"======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========",
"Resolving with primary search path '/types'",