Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 94 additions & 91 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

380 changes: 169 additions & 211 deletions src/compiler/emitter.ts

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,10 @@ module ts {
/* @internal */
export interface EmitResolver {
hasGlobalName(name: string): boolean;
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
getReferencedExportContainer(node: Identifier): SourceFile | ModuleDeclaration | EnumDeclaration;
getReferencedImportDeclaration(node: Identifier): Declaration;
getReferencedNestedRedeclaration(node: Identifier): Declaration;
isNestedRedeclaration(node: Declaration): boolean;
isValueAliasDeclaration(node: Node): boolean;
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
Expand All @@ -1435,12 +1438,11 @@ module ts {
isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult;
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
resolvesToSomeValue(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
getReferencedValueDeclaration(reference: Identifier): Declaration;
serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
serializeTypeOfNode(node: Node): string | string[];
serializeParameterTypesOfNode(node: Node): (string | string[])[];
serializeReturnTypeOfNode(node: Node): string | string[];
}

export const enum SymbolFlags {
Expand Down Expand Up @@ -1517,6 +1519,8 @@ module ts {
HasExports = Class | Enum | Module,
HasMembers = Class | Interface | TypeLiteral | ObjectLiteral,

BlockScoped = BlockScopedVariable | Class | Enum,

PropertyOrAccessor = Property | Accessor,
Export = ExportNamespace | ExportType | ExportValue,
}
Expand Down Expand Up @@ -1548,6 +1552,7 @@ module ts {
unionType?: UnionType; // Containing union type for union property
resolvedExports?: SymbolTable; // Resolved exports of module
exportsChecked?: boolean; // True if exports of external module have been checked
isNestedRedeclaration?: boolean; // True if symbol is block scoped redeclaration
}

/* @internal */
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5For-of17.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ for (let v of []) {
for (var _i = 0, _a = []; _i < _a.length; _i++) {
var v = _a[_i];
v;
for (var _b = 0, _c = [v]; _b < _c.length; _b++) {
for (var _b = 0, _c = [v_1]; _b < _c.length; _b++) {
var v_1 = _c[_b];
var x = v_1;
v_1++;
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5For-of20.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ for (let v of []) {
for (var _i = 0, _a = []; _i < _a.length; _i++) {
var v = _a[_i];
var v_1;
for (var _b = 0, _c = [v]; _b < _c.length; _b++) {
for (var _b = 0, _c = [v_2]; _b < _c.length; _b++) {
var v_2 = _c[_b];
var v_3;
}
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/classDeclarationBlockScoping1.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ var C = (function () {
return C;
})();
{
var C = (function () {
function C() {
var C_1 = (function () {
function C_1() {
}
return C;
return C_1;
})();
}
8 changes: 4 additions & 4 deletions tests/baselines/reference/classDeclarationBlockScoping2.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ function f() {
})();
var c1 = C;
{
var C = (function () {
function C() {
var C_1 = (function () {
function C_1() {
}
return C;
return C_1;
})();
var c2 = C;
var c2 = C_1;
}
return C === c1;
}
8 changes: 4 additions & 4 deletions tests/baselines/reference/exportsAndImports3-amd.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ define(["require", "exports"], function (require, exports) {
exports.v1 = exports.v;
function f() { }
exports.f = f;
exports.f1 = exports.f;
exports.f1 = f;
var C = (function () {
function C() {
}
return C;
})();
exports.C = C;
exports.C1 = exports.C;
exports.C1 = C;
(function (E) {
E[E["A"] = 0] = "A";
E[E["B"] = 1] = "B";
E[E["C"] = 2] = "C";
})(exports.E || (exports.E = {}));
var E = exports.E;
exports.E1 = exports.E;
exports.E1 = E;
var M;
(function (M) {
})(M = exports.M || (exports.M = {}));
exports.M1 = exports.M;
exports.M1 = M;
exports.a = M.x;
exports.a1 = exports.a;
});
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/exportsAndImports3.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,25 @@ exports.v = 1;
exports.v1 = exports.v;
function f() { }
exports.f = f;
exports.f1 = exports.f;
exports.f1 = f;
var C = (function () {
function C() {
}
return C;
})();
exports.C = C;
exports.C1 = exports.C;
exports.C1 = C;
(function (E) {
E[E["A"] = 0] = "A";
E[E["B"] = 1] = "B";
E[E["C"] = 2] = "C";
})(exports.E || (exports.E = {}));
var E = exports.E;
exports.E1 = exports.E;
exports.E1 = E;
var M;
(function (M) {
})(M = exports.M || (exports.M = {}));
exports.M1 = exports.M;
exports.M1 = M;
exports.a = M.x;
exports.a1 = exports.a;
//// [t2.js]
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/localTypes1.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ function f3(b) {
return a;
}
else {
var A = (function () {
function A() {
var A_1 = (function () {
function A_1() {
}
return A;
return A_1;
})();
var c = [new A()];
var c = [new A_1()];
c[0].x = E.B;
return c;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var m2;
_super.apply(this, arguments);
}
return class1;
})(mExported.me.class1);
})(m2.mExported.me.class1);
m2.class1 = class1;
var c2 = new m2.mExported.me.class1;
function f2() {
Expand All @@ -31,7 +31,7 @@ var m2;
_super.apply(this, arguments);
}
return class2;
})(mExported.me.class1);
})(m2.mExported.me.class1);
m2.c3 = new mNonExported.mne.class1;
function f3() {
return new mNonExported.mne.class1();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var m2;
_super.apply(this, arguments);
}
return class1;
})(mExported.me.class1);
})(m2.mExported.me.class1);
m2.class1 = class1;
var c2 = new m2.mExported.me.class1;
function f2() {
Expand All @@ -31,7 +31,7 @@ var m2;
_super.apply(this, arguments);
}
return class2;
})(mExported.me.class1);
})(m2.mExported.me.class1);
m2.c3 = new mNonExported.mne.class1;
function f3() {
return new mNonExported.mne.class1();
Expand Down