mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Simplify module kind selection
This commit is contained in:
@@ -5413,14 +5413,14 @@ module ts {
|
||||
extendsEmitted = true;
|
||||
}
|
||||
if (isExternalModule(node)) {
|
||||
if (compilerOptions.module === ModuleKind.AMD) {
|
||||
if (compilerOptions.target >= ScriptTarget.ES6) {
|
||||
emitES6Module(node, startIndex);
|
||||
}
|
||||
else if (compilerOptions.module === ModuleKind.AMD) {
|
||||
emitAMDModule(node, startIndex);
|
||||
}
|
||||
else if (compilerOptions.module === ModuleKind.CommonJS || compilerOptions.target < ScriptTarget.ES6) {
|
||||
emitCommonJSModule(node, startIndex);
|
||||
}
|
||||
else {
|
||||
emitES6Module(node, startIndex);
|
||||
emitCommonJSModule(node, startIndex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -49,41 +49,37 @@ m.x.toString();
|
||||
|
||||
|
||||
//// [constDeclarations_access_1.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
exports.x = 0;
|
||||
});
|
||||
exports.x = 0;
|
||||
//// [constDeclarations_access_2.js]
|
||||
define(["require", "exports", 'constDeclarations_access_1'], function (require, exports, m) {
|
||||
// Errors
|
||||
m.x = 1;
|
||||
m.x += 2;
|
||||
m.x -= 3;
|
||||
m.x *= 4;
|
||||
m.x /= 5;
|
||||
m.x %= 6;
|
||||
m.x <<= 7;
|
||||
m.x >>= 8;
|
||||
m.x >>>= 9;
|
||||
m.x &= 10;
|
||||
m.x |= 11;
|
||||
m.x ^= 12;
|
||||
m;
|
||||
m.x++;
|
||||
m.x--;
|
||||
++m.x;
|
||||
--m.x;
|
||||
++((m.x));
|
||||
m["x"] = 0;
|
||||
// OK
|
||||
var a = m.x + 1;
|
||||
function f(v) {
|
||||
}
|
||||
f(m.x);
|
||||
if (m.x) {
|
||||
}
|
||||
m.x;
|
||||
(m.x);
|
||||
-m.x;
|
||||
+m.x;
|
||||
m.x.toString();
|
||||
});
|
||||
// Errors
|
||||
m.x = 1;
|
||||
m.x += 2;
|
||||
m.x -= 3;
|
||||
m.x *= 4;
|
||||
m.x /= 5;
|
||||
m.x %= 6;
|
||||
m.x <<= 7;
|
||||
m.x >>= 8;
|
||||
m.x >>>= 9;
|
||||
m.x &= 10;
|
||||
m.x |= 11;
|
||||
m.x ^= 12;
|
||||
m;
|
||||
m.x++;
|
||||
m.x--;
|
||||
++m.x;
|
||||
--m.x;
|
||||
++((m.x));
|
||||
m["x"] = 0;
|
||||
// OK
|
||||
var a = m.x + 1;
|
||||
function f(v) {
|
||||
}
|
||||
f(m.x);
|
||||
if (m.x) {
|
||||
}
|
||||
m.x;
|
||||
(m.x);
|
||||
-m.x;
|
||||
+m.x;
|
||||
m.x.toString();
|
||||
|
||||
@@ -12,14 +12,12 @@ export class A
|
||||
}
|
||||
|
||||
//// [es6ModuleWithModuleGenTargetAmd.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
A.prototype.B = function () {
|
||||
return 42;
|
||||
};
|
||||
return A;
|
||||
})();
|
||||
exports.A = A;
|
||||
});
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
A.prototype.B = function () {
|
||||
return 42;
|
||||
};
|
||||
return A;
|
||||
})();
|
||||
exports.A = A;
|
||||
|
||||
Reference in New Issue
Block a user