Skip to content

Fix code for immediately 'new'-ed/invoked class expressions #6004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 9, 2015
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5260,11 +5260,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
writeLine();
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
emitStart(node);
write(")(");
write("(");
if (baseTypeNode) {
emit(baseTypeNode.expression);
}
write(")");
write("))");
if (node.kind === SyntaxKind.ClassDeclaration) {
write(";");
}
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/2dArrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ var Cell = (function () {
function Cell() {
}
return Cell;
})();
}());
var Ship = (function () {
function Ship() {
}
return Ship;
})();
}());
var Board = (function () {
function Board() {
}
Board.prototype.allShipsSunk = function () {
return this.ships.every(function (val) { return val.isSunk; });
};
return Board;
})();
}());
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var A;
this.y = y;
}
return Point;
})();
}());
A.Point = Point;
})(A || (A = {}));
//// [test.js]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var clodule1 = (function () {
function clodule1() {
}
return clodule1;
})();
}());
var clodule1;
(function (clodule1) {
function f(x) { }
Expand All @@ -64,21 +64,21 @@ var clodule2 = (function () {
function clodule2() {
}
return clodule2;
})();
}());
var clodule2;
(function (clodule2) {
var x;
var D = (function () {
function D() {
}
return D;
})();
}());
})(clodule2 || (clodule2 = {}));
var clodule3 = (function () {
function clodule3() {
}
return clodule3;
})();
}());
var clodule3;
(function (clodule3) {
clodule3.y = { id: T };
Expand All @@ -87,12 +87,12 @@ var clodule4 = (function () {
function clodule4() {
}
return clodule4;
})();
}());
var clodule4;
(function (clodule4) {
var D = (function () {
function D() {
}
return D;
})();
}());
})(clodule4 || (clodule4 = {}));
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var clodule = (function () {
}
clodule.fn = function (id) { };
return clodule;
})();
}());
var clodule;
(function (clodule) {
// error: duplicate identifier expected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var clodule = (function () {
}
clodule.fn = function (id) { };
return clodule;
})();
}());
var clodule;
(function (clodule) {
// error: duplicate identifier expected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var clodule = (function () {
}
clodule.sfn = function (id) { return 42; };
return clodule;
})();
}());
var clodule;
(function (clodule) {
// error: duplicate identifier expected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var Point = (function () {
}
Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246
return Point;
})();
}());
var Point;
(function (Point) {
function Origin() { return null; }
Expand All @@ -45,7 +45,7 @@ var A;
}
Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246
return Point;
})();
}());
A.Point = Point;
var Point;
(function (Point) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var Point = (function () {
}
Point.Origin = function () { return { x: 0, y: 0 }; };
return Point;
})();
}());
var Point;
(function (Point) {
function Origin() { return ""; } // not an error, since not exported
Expand All @@ -44,7 +44,7 @@ var A;
}
Point.Origin = function () { return { x: 0, y: 0 }; };
return Point;
})();
}());
A.Point = Point;
var Point;
(function (Point) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var Point = (function () {
}
Point.Origin = { x: 0, y: 0 };
return Point;
})();
}());
var Point;
(function (Point) {
Point.Origin = ""; //expected duplicate identifier error
Expand All @@ -44,7 +44,7 @@ var A;
}
Point.Origin = { x: 0, y: 0 };
return Point;
})();
}());
A.Point = Point;
var Point;
(function (Point) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var Point = (function () {
}
Point.Origin = { x: 0, y: 0 };
return Point;
})();
}());
var Point;
(function (Point) {
var Origin = ""; // not an error, since not exported
Expand All @@ -44,7 +44,7 @@ var A;
}
Point.Origin = { x: 0, y: 0 };
return Point;
})();
}());
A.Point = Point;
var Point;
(function (Point) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var X;
this.y = y;
}
return Point;
})();
}());
Y.Point = Point;
})(Y = X.Y || (X.Y = {}));
})(X || (X = {}));
Expand All @@ -75,7 +75,7 @@ var A = (function () {
function A() {
}
return A;
})();
}());
var A;
(function (A) {
A.Instance = new A();
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration10.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ var C = (function () {
function C() {
}
return C;
})();
}());
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration11.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ var C = (function () {
}
C.prototype.foo = function () { };
return C;
})();
}());
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration13.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ var C = (function () {
}
C.prototype.bar = function () { };
return C;
})();
}());
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration14.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ var C = (function () {
function C() {
}
return C;
})();
}());
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration15.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ var C = (function () {
function C() {
}
return C;
})();
}());
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration21.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ var C = (function () {
}
C.prototype[1] = function () { };
return C;
})();
}());
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration22.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ var C = (function () {
}
C.prototype["bar"] = function () { };
return C;
})();
}());
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration24.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ var any = (function () {
function any() {
}
return any;
})();
}());
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration25.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ var List = (function () {
function List() {
}
return List;
})();
}());
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration26.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ var C = (function () {
this.foo = 10;
}
return C;
})();
}());
var constructor = function () { };
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration8.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ var C = (function () {
function C() {
}
return C;
})();
}());
2 changes: 1 addition & 1 deletion tests/baselines/reference/ClassDeclaration9.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ var C = (function () {
function C() {
}
return C;
})();
}());
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ var AtomicNumbers = (function () {
}
AtomicNumbers.H = 1;
return AtomicNumbers;
})();
}());
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ var C = (function () {
this.x = 10;
}
return C;
})();
}());
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5For-ofTypeCheck10.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ var StringIterator = (function () {
return this;
};
return StringIterator;
})();
}());
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5SymbolProperty2.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var M;
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
}());
M.C = C;
(new C)[Symbol.iterator];
})(M || (M = {}));
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5SymbolProperty3.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ var C = (function () {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
}());
(new C)[Symbol.iterator];
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5SymbolProperty4.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ var C = (function () {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
}());
(new C)[Symbol.iterator];
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5SymbolProperty5.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ var C = (function () {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
}());
(new C)[Symbol.iterator](0); // Should error
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5SymbolProperty6.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ var C = (function () {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
}());
(new C)[Symbol.iterator];
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5SymbolProperty7.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ var C = (function () {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
}());
(new C)[Symbol.iterator];
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var enumdule;
this.y = y;
}
return Point;
})();
}());
enumdule.Point = Point;
})(enumdule || (enumdule = {}));
var x;
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ExportAssignment7.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ var C = (function () {
function C() {
}
return C;
})();
}());
exports.C = C;
2 changes: 1 addition & 1 deletion tests/baselines/reference/ExportAssignment8.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ var C = (function () {
function C() {
}
return C;
})();
}());
exports.C = C;
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ var A;
return 1;
};
return Point2d;
})();
}());
A.Point2d = Point2d;
})(A || (A = {}));
Loading