diff --git a/tests/baselines/reference/decoratorOnClassConstructor3.js b/tests/baselines/reference/decoratorOnClassConstructor3.js new file mode 100644 index 0000000000..66946fab8b --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassConstructor3.js @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor3.ts] //// + +//// [0.ts] + +export class base { } +export function foo(target: Object, propertyKey: string | symbol, parameterIndex: number) { } + +//// [2.ts] +import {base} from "./0" +import {foo} from "./0" + +/* Comment on the Class Declaration */ +export class C extends base{ + constructor(@foo prop: any) { + super(); + } +} + +//// [0.js] +"use strict"; +var base = (function () { + function base() { + } + return base; +}()); +exports.base = base; +function foo(target, propertyKey, parameterIndex) { } +exports.foo = foo; +//// [2.js] +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __param = (this && this.__param) || function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +}; +var _0_1 = require("./0"); +var _0_2 = require("./0"); +/* Comment on the Class Declaration */ +var C = (function (_super) { + __extends(C, _super); + function C(prop) { + _super.call(this); + } + return C; +}(_0_1.base)); +C = __decorate([ + __param(0, _0_2.foo) +], C); +exports.C = C; diff --git a/tests/baselines/reference/decoratorOnClassConstructor3.symbols b/tests/baselines/reference/decoratorOnClassConstructor3.symbols new file mode 100644 index 0000000000..12c20c9a8c --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassConstructor3.symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/decorators/class/constructor/0.ts === + +export class base { } +>base : Symbol(base, Decl(0.ts, 0, 0)) + +export function foo(target: Object, propertyKey: string | symbol, parameterIndex: number) { } +>foo : Symbol(foo, Decl(0.ts, 1, 21)) +>target : Symbol(target, Decl(0.ts, 2, 20)) +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>propertyKey : Symbol(propertyKey, Decl(0.ts, 2, 35)) +>parameterIndex : Symbol(parameterIndex, Decl(0.ts, 2, 65)) + +=== tests/cases/conformance/decorators/class/constructor/2.ts === +import {base} from "./0" +>base : Symbol(base, Decl(2.ts, 0, 8)) + +import {foo} from "./0" +>foo : Symbol(foo, Decl(2.ts, 1, 8)) + +/* Comment on the Class Declaration */ +export class C extends base{ +>C : Symbol(C, Decl(2.ts, 1, 23)) +>base : Symbol(base, Decl(2.ts, 0, 8)) + + constructor(@foo prop: any) { +>foo : Symbol(foo, Decl(2.ts, 1, 8)) +>prop : Symbol(prop, Decl(2.ts, 5, 16)) + + super(); +>super : Symbol(base, Decl(0.ts, 0, 0)) + } +} diff --git a/tests/baselines/reference/decoratorOnClassConstructor3.types b/tests/baselines/reference/decoratorOnClassConstructor3.types new file mode 100644 index 0000000000..dc1e22c168 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassConstructor3.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/decorators/class/constructor/0.ts === + +export class base { } +>base : base + +export function foo(target: Object, propertyKey: string | symbol, parameterIndex: number) { } +>foo : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void +>target : Object +>Object : Object +>propertyKey : string | symbol +>parameterIndex : number + +=== tests/cases/conformance/decorators/class/constructor/2.ts === +import {base} from "./0" +>base : typeof base + +import {foo} from "./0" +>foo : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void + +/* Comment on the Class Declaration */ +export class C extends base{ +>C : C +>base : base + + constructor(@foo prop: any) { +>foo : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void +>prop : any + + super(); +>super() : void +>super : typeof base + } +} diff --git a/tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor3.ts b/tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor3.ts new file mode 100644 index 0000000000..ca89b65a7a --- /dev/null +++ b/tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor3.ts @@ -0,0 +1,18 @@ +// @target: es5 +// @module: commonjs +// @experimentaldecorators: true + +// @Filename: 0.ts +export class base { } +export function foo(target: Object, propertyKey: string | symbol, parameterIndex: number) { } + +// @Filename: 2.ts +import {base} from "./0" +import {foo} from "./0" + +/* Comment on the Class Declaration */ +export class C extends base{ + constructor(@foo prop: any) { + super(); + } +} \ No newline at end of file