Adds minimal support for 'this' types in decorator metadata, emitting 'Object' for now.

This commit is contained in:
Ron Buckton
2015-11-19 09:53:32 -08:00
parent 4be0095a7c
commit 5915fbd292
5 changed files with 33 additions and 0 deletions

View File

@@ -6006,6 +6006,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
case SyntaxKind.UnionType:
case SyntaxKind.IntersectionType:
case SyntaxKind.AnyKeyword:
case SyntaxKind.ThisType:
break;
default:

View File

@@ -12,6 +12,10 @@ declare var decorator: any;
class MyComponent {
constructor(public Service: Service) {
}
@decorator
method(x: this) {
}
}
//// [service.js]
@@ -37,6 +41,14 @@ var MyComponent = (function () {
function MyComponent(Service) {
this.Service = Service;
}
MyComponent.prototype.method = function (x) {
};
__decorate([
decorator,
__metadata('design:type', Function),
__metadata('design:paramtypes', [Object]),
__metadata('design:returntype', void 0)
], MyComponent.prototype, "method", null);
MyComponent = __decorate([
decorator,
__metadata('design:paramtypes', [service_1.default])

View File

@@ -19,4 +19,12 @@ class MyComponent {
>Service : Symbol(Service, Decl(component.ts, 6, 16))
>Service : Symbol(Service, Decl(component.ts, 0, 6))
}
@decorator
>decorator : Symbol(decorator, Decl(component.ts, 2, 11))
method(x: this) {
>method : Symbol(method, Decl(component.ts, 7, 5))
>x : Symbol(x, Decl(component.ts, 10, 11))
}
}

View File

@@ -19,4 +19,12 @@ class MyComponent {
>Service : Service
>Service : Service
}
@decorator
>decorator : any
method(x: this) {
>method : (x: this) => void
>x : this
}
}

View File

@@ -14,4 +14,8 @@ declare var decorator: any;
class MyComponent {
constructor(public Service: Service) {
}
@decorator
method(x: this) {
}
}