TypeScript/tests/baselines/reference/decoratorOnClassMethod2.js

30 lines
1.1 KiB
TypeScript
Raw Normal View History

2015-03-25 01:00:29 +01:00
//// [decoratorOnClassMethod2.ts]
2015-03-17 22:06:06 +01:00
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
@dec public method() {}
2015-03-25 01:00:29 +01:00
}
//// [decoratorOnClassMethod2.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};
var C = (function () {
function C() {
}
C.prototype.method = function () {
};
Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
return C;
})();