From f0a430aef8c582549be6e4956488bc79ccae532c Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 9 Jun 2016 15:52:17 -0700 Subject: [PATCH] Code review comments --- .../reference/es6modulekindWithES5Target.js | 7 ++++- .../es6modulekindWithES5Target.symbols | 24 ++++++++------ .../es6modulekindWithES5Target.types | 6 ++++ .../reference/es6modulekindWithES5Target11.js | 31 +++++++++++++++++++ .../es6modulekindWithES5Target11.symbols | 27 ++++++++++++++++ .../es6modulekindWithES5Target11.types | 29 +++++++++++++++++ .../es6modulekindWithES5Target9.errors.txt | 8 +++-- .../reference/es6modulekindWithES5Target9.js | 7 +++++ .../compiler/es6modulekindWithES5Target.ts | 4 ++- .../compiler/es6modulekindWithES5Target11.ts | 12 +++++++ .../compiler/es6modulekindWithES5Target9.ts | 4 +++ 11 files changed, 146 insertions(+), 13 deletions(-) create mode 100644 tests/baselines/reference/es6modulekindWithES5Target11.js create mode 100644 tests/baselines/reference/es6modulekindWithES5Target11.symbols create mode 100644 tests/baselines/reference/es6modulekindWithES5Target11.types create mode 100644 tests/cases/compiler/es6modulekindWithES5Target11.ts diff --git a/tests/baselines/reference/es6modulekindWithES5Target.js b/tests/baselines/reference/es6modulekindWithES5Target.js index bab55ec7a2c..cdd1bb018d4 100644 --- a/tests/baselines/reference/es6modulekindWithES5Target.js +++ b/tests/baselines/reference/es6modulekindWithES5Target.js @@ -5,6 +5,7 @@ export class C { p = 1; method() { } } +export { C as C2 }; declare function foo(...args: any[]): any; @foo @@ -13,9 +14,11 @@ export class D { p = 1; method() { } } +export { D as D2 }; class E { } -export {E}; +export {E}; + //// [es6modulekindWithES5Target.js] var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { @@ -32,6 +35,7 @@ export var C = (function () { C.s = 0; return C; }()); +export { C as C2 }; export var D = (function () { function D() { this.p = 1; @@ -43,6 +47,7 @@ export var D = (function () { ], D); return D; }()); +export { D as D2 }; var E = (function () { function E() { } diff --git a/tests/baselines/reference/es6modulekindWithES5Target.symbols b/tests/baselines/reference/es6modulekindWithES5Target.symbols index 4fe53ced68d..2d2a3f6732c 100644 --- a/tests/baselines/reference/es6modulekindWithES5Target.symbols +++ b/tests/baselines/reference/es6modulekindWithES5Target.symbols @@ -12,30 +12,36 @@ export class C { method() { } >method : Symbol(C.method, Decl(es6modulekindWithES5Target.ts, 3, 10)) } +export { C as C2 }; +>C : Symbol(C2, Decl(es6modulekindWithES5Target.ts, 6, 8)) +>C2 : Symbol(C2, Decl(es6modulekindWithES5Target.ts, 6, 8)) declare function foo(...args: any[]): any; ->foo : Symbol(foo, Decl(es6modulekindWithES5Target.ts, 5, 1)) ->args : Symbol(args, Decl(es6modulekindWithES5Target.ts, 7, 21)) +>foo : Symbol(foo, Decl(es6modulekindWithES5Target.ts, 6, 19)) +>args : Symbol(args, Decl(es6modulekindWithES5Target.ts, 8, 21)) @foo ->foo : Symbol(foo, Decl(es6modulekindWithES5Target.ts, 5, 1)) +>foo : Symbol(foo, Decl(es6modulekindWithES5Target.ts, 6, 19)) export class D { ->D : Symbol(D, Decl(es6modulekindWithES5Target.ts, 7, 42)) +>D : Symbol(D, Decl(es6modulekindWithES5Target.ts, 8, 42)) static s = 0; ->s : Symbol(D.s, Decl(es6modulekindWithES5Target.ts, 9, 16)) +>s : Symbol(D.s, Decl(es6modulekindWithES5Target.ts, 10, 16)) p = 1; ->p : Symbol(D.p, Decl(es6modulekindWithES5Target.ts, 10, 17)) +>p : Symbol(D.p, Decl(es6modulekindWithES5Target.ts, 11, 17)) method() { } ->method : Symbol(D.method, Decl(es6modulekindWithES5Target.ts, 11, 10)) +>method : Symbol(D.method, Decl(es6modulekindWithES5Target.ts, 12, 10)) } +export { D as D2 }; +>D : Symbol(D2, Decl(es6modulekindWithES5Target.ts, 15, 8)) +>D2 : Symbol(D2, Decl(es6modulekindWithES5Target.ts, 15, 8)) class E { } ->E : Symbol(E, Decl(es6modulekindWithES5Target.ts, 13, 1)) +>E : Symbol(E, Decl(es6modulekindWithES5Target.ts, 15, 19)) export {E}; ->E : Symbol(E, Decl(es6modulekindWithES5Target.ts, 16, 8)) +>E : Symbol(E, Decl(es6modulekindWithES5Target.ts, 18, 8)) diff --git a/tests/baselines/reference/es6modulekindWithES5Target.types b/tests/baselines/reference/es6modulekindWithES5Target.types index 14e0533faaa..f7232f20494 100644 --- a/tests/baselines/reference/es6modulekindWithES5Target.types +++ b/tests/baselines/reference/es6modulekindWithES5Target.types @@ -14,6 +14,9 @@ export class C { method() { } >method : () => void } +export { C as C2 }; +>C : typeof C +>C2 : typeof C declare function foo(...args: any[]): any; >foo : (...args: any[]) => any @@ -36,6 +39,9 @@ export class D { method() { } >method : () => void } +export { D as D2 }; +>D : typeof D +>D2 : typeof D class E { } >E : E diff --git a/tests/baselines/reference/es6modulekindWithES5Target11.js b/tests/baselines/reference/es6modulekindWithES5Target11.js new file mode 100644 index 00000000000..67196ba2054 --- /dev/null +++ b/tests/baselines/reference/es6modulekindWithES5Target11.js @@ -0,0 +1,31 @@ +//// [es6modulekindWithES5Target11.ts] + +declare function foo(...args: any[]): any; +@foo +export default class C { + static x() { return C.y; } + static y = 1 + p = 1; + method() { } +} + +//// [es6modulekindWithES5Target11.js] +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 C = (function () { + function C() { + this.p = 1; + } + C.x = function () { return C.y; }; + C.prototype.method = function () { }; + C.y = 1; + C = __decorate([ + foo + ], C); + return C; +}()); +export default C; diff --git a/tests/baselines/reference/es6modulekindWithES5Target11.symbols b/tests/baselines/reference/es6modulekindWithES5Target11.symbols new file mode 100644 index 00000000000..144d306c5fb --- /dev/null +++ b/tests/baselines/reference/es6modulekindWithES5Target11.symbols @@ -0,0 +1,27 @@ +=== tests/cases/compiler/es6modulekindWithES5Target11.ts === + +declare function foo(...args: any[]): any; +>foo : Symbol(foo, Decl(es6modulekindWithES5Target11.ts, 0, 0)) +>args : Symbol(args, Decl(es6modulekindWithES5Target11.ts, 1, 21)) + +@foo +>foo : Symbol(foo, Decl(es6modulekindWithES5Target11.ts, 0, 0)) + +export default class C { +>C : Symbol(C, Decl(es6modulekindWithES5Target11.ts, 1, 42)) + + static x() { return C.y; } +>x : Symbol(C.x, Decl(es6modulekindWithES5Target11.ts, 3, 24)) +>C.y : Symbol(C.y, Decl(es6modulekindWithES5Target11.ts, 4, 30)) +>C : Symbol(C, Decl(es6modulekindWithES5Target11.ts, 1, 42)) +>y : Symbol(C.y, Decl(es6modulekindWithES5Target11.ts, 4, 30)) + + static y = 1 +>y : Symbol(C.y, Decl(es6modulekindWithES5Target11.ts, 4, 30)) + + p = 1; +>p : Symbol(C.p, Decl(es6modulekindWithES5Target11.ts, 5, 16)) + + method() { } +>method : Symbol(C.method, Decl(es6modulekindWithES5Target11.ts, 6, 10)) +} diff --git a/tests/baselines/reference/es6modulekindWithES5Target11.types b/tests/baselines/reference/es6modulekindWithES5Target11.types new file mode 100644 index 00000000000..51fbe371017 --- /dev/null +++ b/tests/baselines/reference/es6modulekindWithES5Target11.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/es6modulekindWithES5Target11.ts === + +declare function foo(...args: any[]): any; +>foo : (...args: any[]) => any +>args : any[] + +@foo +>foo : (...args: any[]) => any + +export default class C { +>C : C + + static x() { return C.y; } +>x : () => number +>C.y : number +>C : typeof C +>y : number + + static y = 1 +>y : number +>1 : number + + p = 1; +>p : number +>1 : number + + method() { } +>method : () => void +} diff --git a/tests/baselines/reference/es6modulekindWithES5Target9.errors.txt b/tests/baselines/reference/es6modulekindWithES5Target9.errors.txt index 696b28a30e8..2e9a35a8783 100644 --- a/tests/baselines/reference/es6modulekindWithES5Target9.errors.txt +++ b/tests/baselines/reference/es6modulekindWithES5Target9.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/es6modulekindWithES5Target9.ts(2,15): error TS2307: Cannot find module 'mod'. tests/cases/compiler/es6modulekindWithES5Target9.ts(4,17): error TS2307: Cannot find module 'mod'. tests/cases/compiler/es6modulekindWithES5Target9.ts(6,20): error TS2307: Cannot find module 'mod'. -tests/cases/compiler/es6modulekindWithES5Target9.ts(10,15): error TS2307: Cannot find module 'mod'. -tests/cases/compiler/es6modulekindWithES5Target9.ts(12,17): error TS2307: Cannot find module 'mod'. +tests/cases/compiler/es6modulekindWithES5Target9.ts(14,15): error TS2307: Cannot find module 'mod'. +tests/cases/compiler/es6modulekindWithES5Target9.ts(16,17): error TS2307: Cannot find module 'mod'. ==== tests/cases/compiler/es6modulekindWithES5Target9.ts (5 errors) ==== @@ -21,6 +21,10 @@ tests/cases/compiler/es6modulekindWithES5Target9.ts(12,17): error TS2307: Cannot export {a}; + export {M}; + + export {d}; + export * from "mod"; ~~~~~ !!! error TS2307: Cannot find module 'mod'. diff --git a/tests/baselines/reference/es6modulekindWithES5Target9.js b/tests/baselines/reference/es6modulekindWithES5Target9.js index a9569c42dd9..97991b40b0c 100644 --- a/tests/baselines/reference/es6modulekindWithES5Target9.js +++ b/tests/baselines/reference/es6modulekindWithES5Target9.js @@ -8,6 +8,10 @@ import * as M from "mod"; export {a}; +export {M}; + +export {d}; + export * from "mod"; export {b} from "mod" @@ -18,7 +22,10 @@ export default d; //// [es6modulekindWithES5Target9.js] import d from "mod"; import { a } from "mod"; +import * as M from "mod"; export { a }; +export { M }; +export { d }; export * from "mod"; export { b } from "mod"; export default d; diff --git a/tests/cases/compiler/es6modulekindWithES5Target.ts b/tests/cases/compiler/es6modulekindWithES5Target.ts index 72117932229..c5ecfdab686 100644 --- a/tests/cases/compiler/es6modulekindWithES5Target.ts +++ b/tests/cases/compiler/es6modulekindWithES5Target.ts @@ -7,6 +7,7 @@ export class C { p = 1; method() { } } +export { C as C2 }; declare function foo(...args: any[]): any; @foo @@ -15,6 +16,7 @@ export class D { p = 1; method() { } } +export { D as D2 }; class E { } -export {E}; \ No newline at end of file +export {E}; diff --git a/tests/cases/compiler/es6modulekindWithES5Target11.ts b/tests/cases/compiler/es6modulekindWithES5Target11.ts new file mode 100644 index 00000000000..af4329200e6 --- /dev/null +++ b/tests/cases/compiler/es6modulekindWithES5Target11.ts @@ -0,0 +1,12 @@ +// @target: es5 +// @module: es2015 +// @experimentalDecorators: true + +declare function foo(...args: any[]): any; +@foo +export default class C { + static x() { return C.y; } + static y = 1 + p = 1; + method() { } +} \ No newline at end of file diff --git a/tests/cases/compiler/es6modulekindWithES5Target9.ts b/tests/cases/compiler/es6modulekindWithES5Target9.ts index e0f7b612c08..6e6fff124dd 100644 --- a/tests/cases/compiler/es6modulekindWithES5Target9.ts +++ b/tests/cases/compiler/es6modulekindWithES5Target9.ts @@ -9,6 +9,10 @@ import * as M from "mod"; export {a}; +export {M}; + +export {d}; + export * from "mod"; export {b} from "mod"