Merge branch 'exportEquals' into exportEqualsMerged
This commit is contained in:
commit
4361e6ea56
4 changed files with 21 additions and 7 deletions
|
@ -3668,6 +3668,10 @@ module ts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isDefaultImport(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration) {
|
||||||
|
return node.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node).importClause && !!(<ImportDeclaration>node).importClause.name;
|
||||||
|
}
|
||||||
|
|
||||||
function emitExportImportAssignments(node: Node) {
|
function emitExportImportAssignments(node: Node) {
|
||||||
if (isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) {
|
if (isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) {
|
||||||
emitExportMemberAssignments(<Identifier>(<Declaration>node).name);
|
emitExportMemberAssignments(<Identifier>(<Declaration>node).name);
|
||||||
|
@ -3751,8 +3755,7 @@ module ts {
|
||||||
if (compilerOptions.module !== ModuleKind.AMD) {
|
if (compilerOptions.module !== ModuleKind.AMD) {
|
||||||
emitLeadingComments(node);
|
emitLeadingComments(node);
|
||||||
emitStart(node);
|
emitStart(node);
|
||||||
let isDefaultImport = node.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node).importClause && !!(<ImportDeclaration>node).importClause.name;
|
if (namespaceDeclaration && !isDefaultImport(node)) {
|
||||||
if (namespaceDeclaration && !isDefaultImport) {
|
|
||||||
// import x = require("foo")
|
// import x = require("foo")
|
||||||
// import * as x from "foo"
|
// import * as x from "foo"
|
||||||
if (!isExportedImport) write("var ");
|
if (!isExportedImport) write("var ");
|
||||||
|
@ -3773,7 +3776,7 @@ module ts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emitRequire(getExternalModuleName(node));
|
emitRequire(getExternalModuleName(node));
|
||||||
if (namespaceDeclaration && isDefaultImport) {
|
if (namespaceDeclaration && isDefaultImport(node)) {
|
||||||
// import d, * as x from "foo"
|
// import d, * as x from "foo"
|
||||||
write(", ");
|
write(", ");
|
||||||
emitModuleMemberName(namespaceDeclaration);
|
emitModuleMemberName(namespaceDeclaration);
|
||||||
|
@ -3792,6 +3795,14 @@ module ts {
|
||||||
emit(namespaceDeclaration.name);
|
emit(namespaceDeclaration.name);
|
||||||
write(";");
|
write(";");
|
||||||
}
|
}
|
||||||
|
else if (namespaceDeclaration && isDefaultImport(node)) {
|
||||||
|
// import d, * as x from "foo"
|
||||||
|
write("var ");
|
||||||
|
emitModuleMemberName(namespaceDeclaration);
|
||||||
|
write(" = ");
|
||||||
|
write(resolver.getGeneratedNameForNode(<ImportDeclaration>node));
|
||||||
|
write(";");
|
||||||
|
}
|
||||||
emitExportImportAssignments(node);
|
emitExportImportAssignments(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4077,7 +4088,7 @@ module ts {
|
||||||
for (let importNode of externalImports) {
|
for (let importNode of externalImports) {
|
||||||
write(", ");
|
write(", ");
|
||||||
let namespaceDeclaration = getNamespaceDeclarationNode(importNode);
|
let namespaceDeclaration = getNamespaceDeclarationNode(importNode);
|
||||||
if (namespaceDeclaration) {
|
if (namespaceDeclaration && !isDefaultImport(importNode)) {
|
||||||
emit(namespaceDeclaration.name);
|
emit(namespaceDeclaration.name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -15,7 +15,8 @@ define(["require", "exports"], function (require, exports) {
|
||||||
exports.default = a;
|
exports.default = a;
|
||||||
});
|
});
|
||||||
//// [client.js]
|
//// [client.js]
|
||||||
define(["require", "exports", "server"], function (require, exports, nameSpaceBinding) {
|
define(["require", "exports", "server"], function (require, exports, _server) {
|
||||||
|
var nameSpaceBinding = _server;
|
||||||
exports.x = _server.default;
|
exports.x = _server.default;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@ define(["require", "exports"], function (require, exports) {
|
||||||
exports.default = a;
|
exports.default = a;
|
||||||
});
|
});
|
||||||
//// [client.js]
|
//// [client.js]
|
||||||
define(["require", "exports", "server"], function (require, exports, nameSpaceBinding) {
|
define(["require", "exports", "server"], function (require, exports, _server) {
|
||||||
|
var nameSpaceBinding = _server;
|
||||||
exports.x = new _server.default();
|
exports.x = new _server.default();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ define(["require", "exports"], function (require, exports) {
|
||||||
exports.default = "hello";
|
exports.default = "hello";
|
||||||
});
|
});
|
||||||
//// [t3.js]
|
//// [t3.js]
|
||||||
define(["require", "exports", "./t1", "./t1", "./t1", "./t1", "./t1", "./t1"], function (require, exports, a, _t1, c, _t1_2, e2, _t1_4) {
|
define(["require", "exports", "./t1", "./t1", "./t1", "./t1", "./t1", "./t1"], function (require, exports, a, _t1, c, _t1_2, _t1_3, _t1_4) {
|
||||||
exports.a = a;
|
exports.a = a;
|
||||||
a.default;
|
a.default;
|
||||||
exports.b = _t1.default;
|
exports.b = _t1.default;
|
||||||
|
@ -53,6 +53,7 @@ define(["require", "exports", "./t1", "./t1", "./t1", "./t1", "./t1", "./t1"], f
|
||||||
c.default;
|
c.default;
|
||||||
exports.d = _t1_2.default;
|
exports.d = _t1_2.default;
|
||||||
_t1_2.default;
|
_t1_2.default;
|
||||||
|
var e2 = _t1_3;
|
||||||
exports.e1 = _t1_3.default;
|
exports.e1 = _t1_3.default;
|
||||||
exports.e2 = e2;
|
exports.e2 = e2;
|
||||||
_t1_3.default;
|
_t1_3.default;
|
||||||
|
|
Loading…
Reference in a new issue