Skip to content

Commit b65c648

Browse files
committed
Merge branch 'transforms' into transforms-importHelpers
2 parents d5f5d92 + 03d273e commit b65c648

6 files changed

+41
-42
lines changed

src/compiler/transformers/ts.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,10 +1619,10 @@ namespace ts {
16191619
* @param node The type node.
16201620
*/
16211621
function getRestParameterElementType(node: TypeNode) {
1622-
if (node.kind === SyntaxKind.ArrayType) {
1622+
if (node && node.kind === SyntaxKind.ArrayType) {
16231623
return (<ArrayTypeNode>node).elementType;
16241624
}
1625-
else if (node.kind === SyntaxKind.TypeReference) {
1625+
else if (node && node.kind === SyntaxKind.TypeReference) {
16261626
return singleOrUndefined((<TypeReferenceNode>node).typeArguments);
16271627
}
16281628
else {
@@ -1667,6 +1667,9 @@ namespace ts {
16671667
if (isFunctionLike(node) && node.type) {
16681668
return serializeTypeNode(node.type);
16691669
}
1670+
else if (isAsyncFunctionLike(node)) {
1671+
return createIdentifier("Promise");
1672+
}
16701673

16711674
return createVoidZero();
16721675
}

tests/baselines/reference/decoratorMetadataPromise.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,20 @@ class A {
4040
baz(n) { return n; }
4141
}
4242
__decorate([
43-
decorator,
44-
__metadata('design:type', Function),
45-
__metadata('design:paramtypes', []),
46-
__metadata('design:returntype', Promise)
43+
decorator,
44+
__metadata("design:type", Function),
45+
__metadata("design:paramtypes", []),
46+
__metadata("design:returntype", Promise)
4747
], A.prototype, "foo", null);
4848
__decorate([
49-
decorator,
50-
__metadata('design:type', Function),
51-
__metadata('design:paramtypes', []),
52-
__metadata('design:returntype', Promise)
49+
decorator,
50+
__metadata("design:type", Function),
51+
__metadata("design:paramtypes", []),
52+
__metadata("design:returntype", Promise)
5353
], A.prototype, "bar", null);
5454
__decorate([
55-
decorator,
56-
__metadata('design:type', Function),
57-
__metadata('design:paramtypes', [Promise]),
58-
__metadata('design:returntype', Promise)
55+
decorator,
56+
__metadata("design:type", Function),
57+
__metadata("design:paramtypes", [Promise]),
58+
__metadata("design:returntype", Promise)
5959
], A.prototype, "baz", null);

tests/baselines/reference/disallowAsyncModifierInES5.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//// [disallowAsyncModifierInES5.ts]
2-
3-
async function foo() { return 42; } // ERROR: Async functions are only available in ES6+
4-
let bar = async function () { return 42; } // OK, but should be an error
2+
3+
async function foo() { return 42; } // ERROR: Async functions are only available in ES6+
4+
let bar = async function () { return 42; } // OK, but should be an error
55
let baz = async () => 42; // OK, but should be an error
66

77
//// [disallowAsyncModifierInES5.js]
@@ -20,4 +20,4 @@ function foo() {
2020
var bar = function () {
2121
return __awaiter(this, void 0, void 0, function* () { return 42; });
2222
}; // OK, but should be an error
23-
var baz = function () { return __awaiter(_this, void 0, void 0, function* () { return 42; }); }; // OK, but should be an error
23+
var baz = function () { return __awaiter(_this, void 0, void 0, function* () { return 42; }); }; // OK, but should be an error

tests/baselines/reference/emitDecoratorMetadata_restArgs.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ var A = (function () {
4141
args[_i - 0] = arguments[_i];
4242
}
4343
};
44-
__decorate([
45-
MyMethodDecorator,
46-
__metadata('design:type', Function),
47-
__metadata('design:paramtypes', [Object]),
48-
__metadata('design:returntype', void 0)
49-
], A.prototype, "method", null);
50-
A = __decorate([
51-
MyClassDecorator,
52-
__metadata('design:paramtypes', [Object])
53-
], A);
5444
return A;
5545
}());
46+
__decorate([
47+
MyMethodDecorator,
48+
__metadata("design:type", Function),
49+
__metadata("design:paramtypes", [Object]),
50+
__metadata("design:returntype", void 0)
51+
], A.prototype, "method", null);
52+
A = __decorate([
53+
MyClassDecorator,
54+
__metadata("design:paramtypes", [Object])
55+
], A);
5656
var B = (function () {
5757
function B() {
5858
var args = [];
@@ -66,15 +66,15 @@ var B = (function () {
6666
args[_i - 0] = arguments[_i];
6767
}
6868
};
69-
__decorate([
70-
MyMethodDecorator,
71-
__metadata('design:type', Function),
72-
__metadata('design:paramtypes', [String]),
73-
__metadata('design:returntype', void 0)
74-
], B.prototype, "method", null);
75-
B = __decorate([
76-
MyClassDecorator,
77-
__metadata('design:paramtypes', [Number])
78-
], B);
7969
return B;
8070
}());
71+
__decorate([
72+
MyMethodDecorator,
73+
__metadata("design:type", Function),
74+
__metadata("design:paramtypes", [String]),
75+
__metadata("design:returntype", void 0)
76+
], B.prototype, "method", null);
77+
B = __decorate([
78+
MyClassDecorator,
79+
__metadata("design:paramtypes", [Number])
80+
], B);

tests/baselines/reference/typeReferenceDirectives11.trace.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"======== Resolving module './mod1' from '/mod2.ts'. ========",
33
"Module resolution kind is not specified, using 'Classic'.",
44
"File '/mod1.ts' exist - use it as a name resolution result.",
5-
"Resolving real path for '/mod1.ts', result '/mod1.ts'",
65
"======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========",
76
"======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========",
87
"Resolving with primary search path '/types'",

tests/baselines/reference/typeReferenceDirectives12.trace.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
"======== Resolving module './main' from '/mod2.ts'. ========",
33
"Module resolution kind is not specified, using 'Classic'.",
44
"File '/main.ts' exist - use it as a name resolution result.",
5-
"Resolving real path for '/main.ts', result '/main.ts'",
65
"======== Module name './main' was successfully resolved to '/main.ts'. ========",
76
"======== Resolving module './mod1' from '/mod2.ts'. ========",
87
"Module resolution kind is not specified, using 'Classic'.",
98
"File '/mod1.ts' exist - use it as a name resolution result.",
10-
"Resolving real path for '/mod1.ts', result '/mod1.ts'",
119
"======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========",
1210
"======== Resolving type reference directive 'lib', containing file '/mod1.ts', root directory '/types'. ========",
1311
"Resolving with primary search path '/types'",
@@ -17,7 +15,6 @@
1715
"======== Resolving module './main' from '/mod1.ts'. ========",
1816
"Module resolution kind is not specified, using 'Classic'.",
1917
"File '/main.ts' exist - use it as a name resolution result.",
20-
"Resolving real path for '/main.ts', result '/main.ts'",
2118
"======== Module name './main' was successfully resolved to '/main.ts'. ========",
2219
"======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========",
2320
"Resolving with primary search path '/types'",

0 commit comments

Comments
 (0)