Skip to content

Commit 11944be

Browse files
Merge pull request microsoft#1975 from Microsoft/multiLineEmit2
Provide specialized functions for emitting the body of a function depending on if that body is an expression or a block.
2 parents b3a74ae + b99d70c commit 11944be

File tree

606 files changed

+4799
-9580
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

606 files changed

+4799
-9580
lines changed

src/compiler/emitter.ts

Lines changed: 167 additions & 112 deletions
Large diffs are not rendered by default.

tests/baselines/reference/2dArrays.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ var Board = (function () {
3030
function Board() {
3131
}
3232
Board.prototype.allShipsSunk = function () {
33-
return this.ships.every(function (val) {
34-
return val.isSunk;
35-
});
33+
return this.ships.every(function (val) { return val.isSunk; });
3634
};
3735
return Board;
3836
})();

tests/baselines/reference/APISample_compile.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,8 +1965,6 @@ function compile(fileNames, options) {
19651965
}
19661966
exports.compile = compile;
19671967
compile(process.argv.slice(2), {
1968-
noEmitOnError: true,
1969-
noImplicitAny: true,
1970-
target: 1 /* ES5 */,
1971-
module: 1 /* CommonJS */
1968+
noEmitOnError: true, noImplicitAny: true,
1969+
target: 1 /* ES5 */, module: 1 /* CommonJS */
19721970
});

tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ module clodule {
1919
var clodule = (function () {
2020
function clodule() {
2121
}
22-
clodule.sfn = function (id) {
23-
return 42;
24-
};
22+
clodule.sfn = function (id) { return 42; };
2523
return clodule;
2624
})();
2725
var clodule;

tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,12 @@ var Point = (function () {
2828
this.x = x;
2929
this.y = y;
3030
}
31-
Point.Origin = function () {
32-
return { x: 0, y: 0 };
33-
}; // unexpected error here bug 840246
31+
Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246
3432
return Point;
3533
})();
3634
var Point;
3735
(function (Point) {
38-
function Origin() {
39-
return null;
40-
}
36+
function Origin() { return null; }
4137
Point.Origin = Origin; //expected duplicate identifier error
4238
})(Point || (Point = {}));
4339
var A;
@@ -47,17 +43,13 @@ var A;
4743
this.x = x;
4844
this.y = y;
4945
}
50-
Point.Origin = function () {
51-
return { x: 0, y: 0 };
52-
}; // unexpected error here bug 840246
46+
Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246
5347
return Point;
5448
})();
5549
A.Point = Point;
5650
var Point;
5751
(function (Point) {
58-
function Origin() {
59-
return "";
60-
}
52+
function Origin() { return ""; }
6153
Point.Origin = Origin; //expected duplicate identifier error
6254
})(Point = A.Point || (A.Point = {}));
6355
})(A || (A = {}));

tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,12 @@ var Point = (function () {
2828
this.x = x;
2929
this.y = y;
3030
}
31-
Point.Origin = function () {
32-
return { x: 0, y: 0 };
33-
};
31+
Point.Origin = function () { return { x: 0, y: 0 }; };
3432
return Point;
3533
})();
3634
var Point;
3735
(function (Point) {
38-
function Origin() {
39-
return "";
40-
} // not an error, since not exported
36+
function Origin() { return ""; } // not an error, since not exported
4137
})(Point || (Point = {}));
4238
var A;
4339
(function (A) {
@@ -46,16 +42,12 @@ var A;
4642
this.x = x;
4743
this.y = y;
4844
}
49-
Point.Origin = function () {
50-
return { x: 0, y: 0 };
51-
};
45+
Point.Origin = function () { return { x: 0, y: 0 }; };
5246
return Point;
5347
})();
5448
A.Point = Point;
5549
var Point;
5650
(function (Point) {
57-
function Origin() {
58-
return "";
59-
} // not an error since not exported
51+
function Origin() { return ""; } // not an error since not exported
6052
})(Point = A.Point || (A.Point = {}));
6153
})(A || (A = {}));

tests/baselines/reference/FunctionPropertyAssignments4_es6.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
var v = { * }
33

44
//// [FunctionPropertyAssignments4_es6.js]
5-
var v = { : function () {
6-
} };
5+
var v = { : function () { } };

tests/baselines/reference/YieldExpression10_es6.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ var v = { * foo() {
77

88
//// [YieldExpression10_es6.js]
99
var v = { foo: function () {
10-
;
11-
} };
10+
;
11+
}
12+
};

tests/baselines/reference/YieldExpression13_es6.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
function* foo() { yield }
33

44
//// [YieldExpression13_es6.js]
5-
function foo() {
6-
;
7-
}
5+
function foo() { ; }

tests/baselines/reference/YieldExpression17_es6.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
var v = { get foo() { yield foo; } }
33

44
//// [YieldExpression17_es6.js]
5-
var v = { get foo() {
6-
;
7-
} };
5+
var v = { get foo() { ; } };

0 commit comments

Comments
 (0)