Merge pull request #4750 from Microsoft/Port-4749

Port PR 4749 into release-1.6
This commit is contained in:
Vladimir Matveev 2015-09-11 10:21:20 -07:00
commit 5b764205fe
5 changed files with 318 additions and 1 deletions

View file

@ -3144,6 +3144,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
function emitExportSpecifierInSystemModule(specifier: ExportSpecifier): void {
Debug.assert(compilerOptions.module === ModuleKind.System);
if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier) ) {
return;
}
writeLine();
emitStart(specifier.name);
@ -6106,7 +6110,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
return;
}
if (isInternalModuleImportEqualsDeclaration(node)) {
if (isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) {
if (!hoistedVars) {
hoistedVars = [];
}

View file

@ -0,0 +1,84 @@
//// [tests/cases/compiler/systemModule17.ts] ////
//// [f1.ts]
export class A {}
export interface I {}
//// [f2.ts]
var x = 1;
interface I { }
namespace N {
export var x = 1;
export interface I { }
}
import IX = N.x;
import II = N.I;
import { A, A as EA, I as EI } from "f1";
export {x};
export {x as x1};
export {I};
export {I as I1};
export {A};
export {A as A1};
export {EA};
export {EA as EA1};
export {EI };
export {EI as EI1};
export {IX};
export {IX as IX1};
export {II};
export {II as II1};
//// [f1.js]
System.register([], function(exports_1) {
var A;
return {
setters:[],
execute: function() {
A = (function () {
function A() {
}
return A;
})();
exports_1("A", A);
}
}
});
//// [f2.js]
System.register(["f1"], function(exports_1) {
var f1_1;
var x, N, IX;
return {
setters:[
function (f1_1_1) {
f1_1 = f1_1_1;
}],
execute: function() {
x = 1;
(function (N) {
N.x = 1;
})(N || (N = {}));
IX = N.x;
exports_1("x", x);
exports_1("x1", x);
exports_1("A", f1_1.A);
exports_1("A1", f1_1.A);
exports_1("EA", f1_1.A);
exports_1("EA1", f1_1.A);
exports_1("IX", IX);
exports_1("IX1", IX);
}
}
});

View file

@ -0,0 +1,93 @@
=== tests/cases/compiler/f1.ts ===
export class A {}
>A : Symbol(A, Decl(f1.ts, 0, 0))
export interface I {}
>I : Symbol(I, Decl(f1.ts, 2, 17))
=== tests/cases/compiler/f2.ts ===
var x = 1;
>x : Symbol(x, Decl(f2.ts, 1, 3))
interface I { }
>I : Symbol(I, Decl(f2.ts, 1, 10))
namespace N {
>N : Symbol(N, Decl(f2.ts, 2, 15))
export var x = 1;
>x : Symbol(x, Decl(f2.ts, 5, 11))
export interface I { }
>I : Symbol(I, Decl(f2.ts, 5, 18))
}
import IX = N.x;
>IX : Symbol(IX, Decl(f2.ts, 7, 1))
>N : Symbol(N, Decl(f2.ts, 2, 15))
>x : Symbol(IX, Decl(f2.ts, 5, 11))
import II = N.I;
>II : Symbol(II, Decl(f2.ts, 9, 16))
>N : Symbol(N, Decl(f2.ts, 2, 15))
>I : Symbol(II, Decl(f2.ts, 5, 18))
import { A, A as EA, I as EI } from "f1";
>A : Symbol(A, Decl(f2.ts, 11, 8))
>A : Symbol(EA, Decl(f2.ts, 11, 11))
>EA : Symbol(EA, Decl(f2.ts, 11, 11))
>I : Symbol(EI, Decl(f2.ts, 11, 20))
>EI : Symbol(EI, Decl(f2.ts, 11, 20))
export {x};
>x : Symbol(x, Decl(f2.ts, 13, 8))
export {x as x1};
>x : Symbol(x1, Decl(f2.ts, 14, 8))
>x1 : Symbol(x1, Decl(f2.ts, 14, 8))
export {I};
>I : Symbol(I, Decl(f2.ts, 16, 8))
export {I as I1};
>I : Symbol(I1, Decl(f2.ts, 17, 8))
>I1 : Symbol(I1, Decl(f2.ts, 17, 8))
export {A};
>A : Symbol(A, Decl(f2.ts, 19, 8))
export {A as A1};
>A : Symbol(A1, Decl(f2.ts, 20, 8))
>A1 : Symbol(A1, Decl(f2.ts, 20, 8))
export {EA};
>EA : Symbol(EA, Decl(f2.ts, 22, 8))
export {EA as EA1};
>EA : Symbol(EA1, Decl(f2.ts, 23, 8))
>EA1 : Symbol(EA1, Decl(f2.ts, 23, 8))
export {EI };
>EI : Symbol(EI, Decl(f2.ts, 25, 8))
export {EI as EI1};
>EI : Symbol(EI1, Decl(f2.ts, 26, 8))
>EI1 : Symbol(EI1, Decl(f2.ts, 26, 8))
export {IX};
>IX : Symbol(IX, Decl(f2.ts, 28, 8))
export {IX as IX1};
>IX : Symbol(IX1, Decl(f2.ts, 29, 8))
>IX1 : Symbol(IX1, Decl(f2.ts, 29, 8))
export {II};
>II : Symbol(II, Decl(f2.ts, 31, 8))
export {II as II1};
>II : Symbol(II1, Decl(f2.ts, 32, 8))
>II1 : Symbol(II1, Decl(f2.ts, 32, 8))

View file

@ -0,0 +1,95 @@
=== tests/cases/compiler/f1.ts ===
export class A {}
>A : A
export interface I {}
>I : I
=== tests/cases/compiler/f2.ts ===
var x = 1;
>x : number
>1 : number
interface I { }
>I : I
namespace N {
>N : typeof N
export var x = 1;
>x : number
>1 : number
export interface I { }
>I : I
}
import IX = N.x;
>IX : number
>N : typeof N
>x : number
import II = N.I;
>II : any
>N : typeof N
>I : II
import { A, A as EA, I as EI } from "f1";
>A : typeof A
>A : typeof A
>EA : typeof A
>I : any
>EI : any
export {x};
>x : number
export {x as x1};
>x : number
>x1 : number
export {I};
>I : any
export {I as I1};
>I : any
>I1 : any
export {A};
>A : typeof A
export {A as A1};
>A : typeof A
>A1 : typeof A
export {EA};
>EA : typeof A
export {EA as EA1};
>EA : typeof A
>EA1 : typeof A
export {EI };
>EI : any
export {EI as EI1};
>EI : any
>EI1 : any
export {IX};
>IX : number
export {IX as IX1};
>IX : number
>IX1 : number
export {II};
>II : any
export {II as II1};
>II : any
>II1 : any

View file

@ -0,0 +1,41 @@
// @module: system
// @filename: f1.ts
export class A {}
export interface I {}
// @filename: f2.ts
var x = 1;
interface I { }
namespace N {
export var x = 1;
export interface I { }
}
import IX = N.x;
import II = N.I;
import { A, A as EA, I as EI } from "f1";
export {x};
export {x as x1};
export {I};
export {I as I1};
export {A};
export {A as A1};
export {EA};
export {EA as EA1};
export {EI };
export {EI as EI1};
export {IX};
export {IX as IX1};
export {II};
export {II as II1};