Skip to content

Commit e9911a5

Browse files
committed
Tests and baselines
1 parent 4ff87b7 commit e9911a5

File tree

6 files changed

+126
-0
lines changed

6 files changed

+126
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod11.ts(5,10): error TS2331: 'this' cannot be referenced in a module body.
2+
3+
4+
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod11.ts (1 errors) ====
5+
module M {
6+
class C {
7+
decorator(target: Object, key: string): void { }
8+
9+
@this.decorator
10+
~~~~
11+
!!! error TS2331: 'this' cannot be referenced in a module body.
12+
method() { }
13+
}
14+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//// [decoratorOnClassMethod11.ts]
2+
module M {
3+
class C {
4+
decorator(target: Object, key: string): void { }
5+
6+
@this.decorator
7+
method() { }
8+
}
9+
}
10+
11+
//// [decoratorOnClassMethod11.js]
12+
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
13+
switch (arguments.length) {
14+
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
15+
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
16+
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
17+
}
18+
};
19+
var M;
20+
(function (M) {
21+
var C = (function () {
22+
function C() {
23+
}
24+
C.prototype.decorator = function (target, key) { };
25+
C.prototype.method = function () { };
26+
Object.defineProperty(C.prototype, "method",
27+
__decorate([
28+
this.decorator
29+
], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
30+
return C;
31+
})();
32+
})(M || (M = {}));
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod12.ts(6,10): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
2+
3+
4+
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod12.ts (1 errors) ====
5+
module M {
6+
class S {
7+
decorator(target: Object, key: string): void { }
8+
}
9+
class C extends S {
10+
@super.decorator
11+
~~~~~
12+
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
13+
method() { }
14+
}
15+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//// [decoratorOnClassMethod12.ts]
2+
module M {
3+
class S {
4+
decorator(target: Object, key: string): void { }
5+
}
6+
class C extends S {
7+
@super.decorator
8+
method() { }
9+
}
10+
}
11+
12+
//// [decoratorOnClassMethod12.js]
13+
var __extends = this.__extends || function (d, b) {
14+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
15+
function __() { this.constructor = d; }
16+
__.prototype = b.prototype;
17+
d.prototype = new __();
18+
};
19+
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
20+
switch (arguments.length) {
21+
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
22+
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
23+
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
24+
}
25+
};
26+
var M;
27+
(function (M) {
28+
var S = (function () {
29+
function S() {
30+
}
31+
S.prototype.decorator = function (target, key) { };
32+
return S;
33+
})();
34+
var C = (function (_super) {
35+
__extends(C, _super);
36+
function C() {
37+
_super.apply(this, arguments);
38+
}
39+
C.prototype.method = function () { };
40+
Object.defineProperty(C.prototype, "method",
41+
__decorate([
42+
_super.decorator
43+
], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
44+
return C;
45+
})(S);
46+
})(M || (M = {}));
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @target: ES5
2+
module M {
3+
class C {
4+
decorator(target: Object, key: string): void { }
5+
6+
@this.decorator
7+
method() { }
8+
}
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @target: ES5
2+
module M {
3+
class S {
4+
decorator(target: Object, key: string): void { }
5+
}
6+
class C extends S {
7+
@super.decorator
8+
method() { }
9+
}
10+
}

0 commit comments

Comments
 (0)