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) {
|
||||
if (isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) {
|
||||
emitExportMemberAssignments(<Identifier>(<Declaration>node).name);
|
||||
|
@ -3751,8 +3755,7 @@ module ts {
|
|||
if (compilerOptions.module !== ModuleKind.AMD) {
|
||||
emitLeadingComments(node);
|
||||
emitStart(node);
|
||||
let isDefaultImport = node.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node).importClause && !!(<ImportDeclaration>node).importClause.name;
|
||||
if (namespaceDeclaration && !isDefaultImport) {
|
||||
if (namespaceDeclaration && !isDefaultImport(node)) {
|
||||
// import x = require("foo")
|
||||
// import * as x from "foo"
|
||||
if (!isExportedImport) write("var ");
|
||||
|
@ -3773,7 +3776,7 @@ module ts {
|
|||
}
|
||||
}
|
||||
emitRequire(getExternalModuleName(node));
|
||||
if (namespaceDeclaration && isDefaultImport) {
|
||||
if (namespaceDeclaration && isDefaultImport(node)) {
|
||||
// import d, * as x from "foo"
|
||||
write(", ");
|
||||
emitModuleMemberName(namespaceDeclaration);
|
||||
|
@ -3792,6 +3795,14 @@ module ts {
|
|||
emit(namespaceDeclaration.name);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -4077,7 +4088,7 @@ module ts {
|
|||
for (let importNode of externalImports) {
|
||||
write(", ");
|
||||
let namespaceDeclaration = getNamespaceDeclarationNode(importNode);
|
||||
if (namespaceDeclaration) {
|
||||
if (namespaceDeclaration && !isDefaultImport(importNode)) {
|
||||
emit(namespaceDeclaration.name);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -15,7 +15,8 @@ define(["require", "exports"], function (require, exports) {
|
|||
exports.default = a;
|
||||
});
|
||||
//// [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;
|
||||
});
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ define(["require", "exports"], function (require, exports) {
|
|||
exports.default = a;
|
||||
});
|
||||
//// [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();
|
||||
});
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ define(["require", "exports"], function (require, exports) {
|
|||
exports.default = "hello";
|
||||
});
|
||||
//// [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;
|
||||
a.default;
|
||||
exports.b = _t1.default;
|
||||
|
@ -53,6 +53,7 @@ define(["require", "exports", "./t1", "./t1", "./t1", "./t1", "./t1", "./t1"], f
|
|||
c.default;
|
||||
exports.d = _t1_2.default;
|
||||
_t1_2.default;
|
||||
var e2 = _t1_3;
|
||||
exports.e1 = _t1_3.default;
|
||||
exports.e2 = e2;
|
||||
_t1_3.default;
|
||||
|
|
Loading…
Reference in a new issue