Merge pull request #3223 from Microsoft/port-3109
Port PR 3109 into release 1.5
This commit is contained in:
commit
eaee9ec600
5 changed files with 224 additions and 0 deletions
|
@ -5177,6 +5177,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|||
return exportedDeclarations;
|
||||
|
||||
function visit(node: Node): void {
|
||||
if (node.flags & NodeFlags.Ambient) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.FunctionDeclaration) {
|
||||
if (!hoistedFunctionDeclarations) {
|
||||
hoistedFunctionDeclarations = [];
|
||||
|
|
84
tests/baselines/reference/systemModuleAmbientDeclarations.js
Normal file
84
tests/baselines/reference/systemModuleAmbientDeclarations.js
Normal file
|
@ -0,0 +1,84 @@
|
|||
//// [tests/cases/compiler/systemModuleAmbientDeclarations.ts] ////
|
||||
|
||||
//// [file1.ts]
|
||||
|
||||
declare class Promise { }
|
||||
declare function Foo(): void;
|
||||
declare class C {}
|
||||
declare enum E {X = 1};
|
||||
|
||||
export var promise = Promise;
|
||||
export var foo = Foo;
|
||||
export var c = C;
|
||||
export var e = E;
|
||||
|
||||
//// [file2.ts]
|
||||
export declare function foo();
|
||||
|
||||
//// [file3.ts]
|
||||
export declare class C {}
|
||||
|
||||
//// [file4.ts]
|
||||
export declare var v: number;
|
||||
|
||||
//// [file5.ts]
|
||||
export declare enum E {X = 1}
|
||||
|
||||
//// [file6.ts]
|
||||
export declare module M { var v: number; }
|
||||
|
||||
|
||||
//// [file1.js]
|
||||
System.register([], function(exports_1) {
|
||||
var promise, foo, c, e;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
;
|
||||
exports_1("promise", promise = Promise);
|
||||
exports_1("foo", foo = Foo);
|
||||
exports_1("c", c = C);
|
||||
exports_1("e", e = E);
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [file2.js]
|
||||
System.register([], function(exports_1) {
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [file3.js]
|
||||
System.register([], function(exports_1) {
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [file4.js]
|
||||
System.register([], function(exports_1) {
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [file5.js]
|
||||
System.register([], function(exports_1) {
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [file6.js]
|
||||
System.register([], function(exports_1) {
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
}
|
||||
}
|
||||
});
|
|
@ -0,0 +1,53 @@
|
|||
=== tests/cases/compiler/file1.ts ===
|
||||
|
||||
declare class Promise { }
|
||||
>Promise : Symbol(Promise, Decl(file1.ts, 0, 0))
|
||||
|
||||
declare function Foo(): void;
|
||||
>Foo : Symbol(Foo, Decl(file1.ts, 1, 25))
|
||||
|
||||
declare class C {}
|
||||
>C : Symbol(C, Decl(file1.ts, 2, 29))
|
||||
|
||||
declare enum E {X = 1};
|
||||
>E : Symbol(E, Decl(file1.ts, 3, 18))
|
||||
>X : Symbol(E.X, Decl(file1.ts, 4, 16))
|
||||
|
||||
export var promise = Promise;
|
||||
>promise : Symbol(promise, Decl(file1.ts, 6, 10))
|
||||
>Promise : Symbol(Promise, Decl(file1.ts, 0, 0))
|
||||
|
||||
export var foo = Foo;
|
||||
>foo : Symbol(foo, Decl(file1.ts, 7, 10))
|
||||
>Foo : Symbol(Foo, Decl(file1.ts, 1, 25))
|
||||
|
||||
export var c = C;
|
||||
>c : Symbol(c, Decl(file1.ts, 8, 10))
|
||||
>C : Symbol(C, Decl(file1.ts, 2, 29))
|
||||
|
||||
export var e = E;
|
||||
>e : Symbol(e, Decl(file1.ts, 9, 10))
|
||||
>E : Symbol(E, Decl(file1.ts, 3, 18))
|
||||
|
||||
=== tests/cases/compiler/file2.ts ===
|
||||
export declare function foo();
|
||||
>foo : Symbol(foo, Decl(file2.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/file3.ts ===
|
||||
export declare class C {}
|
||||
>C : Symbol(C, Decl(file3.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/file4.ts ===
|
||||
export declare var v: number;
|
||||
>v : Symbol(v, Decl(file4.ts, 0, 18))
|
||||
|
||||
=== tests/cases/compiler/file5.ts ===
|
||||
export declare enum E {X = 1}
|
||||
>E : Symbol(E, Decl(file5.ts, 0, 0))
|
||||
>X : Symbol(E.X, Decl(file5.ts, 0, 23))
|
||||
|
||||
=== tests/cases/compiler/file6.ts ===
|
||||
export declare module M { var v: number; }
|
||||
>M : Symbol(M, Decl(file6.ts, 0, 0))
|
||||
>v : Symbol(v, Decl(file6.ts, 0, 29))
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
=== tests/cases/compiler/file1.ts ===
|
||||
|
||||
declare class Promise { }
|
||||
>Promise : Promise
|
||||
|
||||
declare function Foo(): void;
|
||||
>Foo : () => void
|
||||
|
||||
declare class C {}
|
||||
>C : C
|
||||
|
||||
declare enum E {X = 1};
|
||||
>E : E
|
||||
>X : E
|
||||
>1 : number
|
||||
|
||||
export var promise = Promise;
|
||||
>promise : typeof Promise
|
||||
>Promise : typeof Promise
|
||||
|
||||
export var foo = Foo;
|
||||
>foo : () => void
|
||||
>Foo : () => void
|
||||
|
||||
export var c = C;
|
||||
>c : typeof C
|
||||
>C : typeof C
|
||||
|
||||
export var e = E;
|
||||
>e : typeof E
|
||||
>E : typeof E
|
||||
|
||||
=== tests/cases/compiler/file2.ts ===
|
||||
export declare function foo();
|
||||
>foo : () => any
|
||||
|
||||
=== tests/cases/compiler/file3.ts ===
|
||||
export declare class C {}
|
||||
>C : C
|
||||
|
||||
=== tests/cases/compiler/file4.ts ===
|
||||
export declare var v: number;
|
||||
>v : number
|
||||
|
||||
=== tests/cases/compiler/file5.ts ===
|
||||
export declare enum E {X = 1}
|
||||
>E : E
|
||||
>X : E
|
||||
>1 : number
|
||||
|
||||
=== tests/cases/compiler/file6.ts ===
|
||||
export declare module M { var v: number; }
|
||||
>M : typeof M
|
||||
>v : number
|
||||
|
28
tests/cases/compiler/systemModuleAmbientDeclarations.ts
Normal file
28
tests/cases/compiler/systemModuleAmbientDeclarations.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
// @module: system
|
||||
// @separateCompilation: true
|
||||
|
||||
// @filename: file1.ts
|
||||
declare class Promise { }
|
||||
declare function Foo(): void;
|
||||
declare class C {}
|
||||
declare enum E {X = 1};
|
||||
|
||||
export var promise = Promise;
|
||||
export var foo = Foo;
|
||||
export var c = C;
|
||||
export var e = E;
|
||||
|
||||
// @filename: file2.ts
|
||||
export declare function foo();
|
||||
|
||||
// @filename: file3.ts
|
||||
export declare class C {}
|
||||
|
||||
// @filename: file4.ts
|
||||
export declare var v: number;
|
||||
|
||||
// @filename: file5.ts
|
||||
export declare enum E {X = 1}
|
||||
|
||||
// @filename: file6.ts
|
||||
export declare module M { var v: number; }
|
Loading…
Reference in a new issue