Address code review: fix indentation

This commit is contained in:
Kanchalai Tanglertsampan 2017-02-08 13:36:19 -08:00
parent a928ad3bd3
commit 8b8c490ff6
17 changed files with 46 additions and 44 deletions

View file

@ -1348,7 +1348,9 @@ namespace ts {
writeToken(SyntaxKind.OpenBraceToken, node.pos, /*contextNode*/ node);
emitBlockStatements(node);
// We have to call emitLeadingComments explicitly here because otherwise leading comments of the close brace token will not be emitted
increaseIndent();
emitLeadingCommentsOfPosition(node.statements.end);
decreaseIndent();
writeToken(SyntaxKind.CloseBraceToken, node.statements.end, /*contextNode*/ node);
}
}

View file

@ -26,6 +26,6 @@ define(["require", "exports"], function (require, exports) {
define(["require", "exports", "./foo_0"], function (require, exports, foo) {
"use strict";
if (foo.E1.A === 0) {
// Should cause runtime import - interesting optimization possibility, as gets inlined to 0.
// Should cause runtime import - interesting optimization possibility, as gets inlined to 0.
}
});

View file

@ -17,7 +17,7 @@ var C = (function () {
}
C.prototype.P = function (ii, j, k) {
for (var i = 0; i < arguments.length; i++) {
// WScript.Echo("param: " + arguments[i]);
// WScript.Echo("param: " + arguments[i]);
}
};
return C;

View file

@ -16,7 +16,7 @@ function ifelse() {
if (commentedParameters(1, 2)) {
/*comment1*/
commentedParameters(3, 4);
/*comment2*/
/*comment2*/
}
else {
commentedParameters(5, 6);

View file

@ -27,5 +27,5 @@ exports.C1 = C1;
"use strict";
var foo = require("./foo_0");
if (foo.C1.s1) {
// Should cause runtime import
// Should cause runtime import
}

View file

@ -391,7 +391,7 @@ var TestRunner = (function () {
}
}
if (testResult === false) {
//console.log(e.message);
//console.log(e.message);
}
}
if ((testcase.errorMessageRegEx !== undefined) && !exception) {

View file

@ -9,6 +9,6 @@ function foo(a) {
//// [out.js]
function foo(a) {
for (var a_1 = 0; a_1 < 10; a_1++) {
// do something
// do something
}
}

View file

@ -27,7 +27,7 @@ function tryCatch() {
//// [narrowExceptionVariableInCatchClause.js]
function tryCatch() {
try {
// do stuff...
// do stuff...
}
catch (err) {
if (isFooError(err)) {

View file

@ -8,9 +8,9 @@ try {
//// [noCatchBlock.js]
try {
// ...
// ...
}
finally {
// N.B. No 'catch' block
// N.B. No 'catch' block
}
//# sourceMappingURL=noCatchBlock.js.map

View file

@ -1,2 +1,2 @@
//// [noCatchBlock.js.map]
{"version":3,"file":"noCatchBlock.js","sourceRoot":"","sources":["noCatchBlock.ts"],"names":[],"mappings":"AACA,IAAI,CAAC;AACJ,MAAM;AACP,CAAC;QAAS,CAAC;AACV,wBAAwB;AACzB,CAAC"}
{"version":3,"file":"noCatchBlock.js","sourceRoot":"","sources":["noCatchBlock.ts"],"names":[],"mappings":"AACA,IAAI,CAAC;IACJ,MAAM;AACP,CAAC;QAAS,CAAC;IACV,wBAAwB;AACzB,CAAC"}

View file

@ -12,7 +12,7 @@ sourceFile:noCatchBlock.ts
1 >
2 >^^^^
3 > ^
4 > ^^->
4 > ^^^^^^->
1 >
>
2 >try
@ -21,14 +21,14 @@ sourceFile:noCatchBlock.ts
2 >Emitted(1, 5) Source(2, 5) + SourceIndex(0)
3 >Emitted(1, 6) Source(2, 6) + SourceIndex(0)
---
>>>// ...
1->
2 >^^^^^^
>>> // ...
1->^^^^
2 > ^^^^^^
1->
>
2 >// ...
1->Emitted(2, 1) Source(3, 2) + SourceIndex(0)
2 >Emitted(2, 7) Source(3, 8) + SourceIndex(0)
2 > // ...
1->Emitted(2, 5) Source(3, 2) + SourceIndex(0)
2 >Emitted(2, 11) Source(3, 8) + SourceIndex(0)
---
>>>}
1 >
@ -43,20 +43,20 @@ sourceFile:noCatchBlock.ts
>>>finally {
1->^^^^^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^->
3 > ^^^^^^^^^^^^^^^^^^^^->
1-> finally
2 > {
1->Emitted(4, 9) Source(4, 11) + SourceIndex(0)
2 >Emitted(4, 10) Source(4, 12) + SourceIndex(0)
---
>>>// N.B. No 'catch' block
1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^
>>> // N.B. No 'catch' block
1->^^^^
2 > ^^^^^^^^^^^^^^^^^^^^^^^^
1->
>
2 >// N.B. No 'catch' block
1->Emitted(5, 1) Source(5, 2) + SourceIndex(0)
2 >Emitted(5, 25) Source(5, 26) + SourceIndex(0)
2 > // N.B. No 'catch' block
1->Emitted(5, 5) Source(5, 2) + SourceIndex(0)
2 >Emitted(5, 29) Source(5, 26) + SourceIndex(0)
---
>>>}
1 >

View file

@ -37,5 +37,5 @@ for (let _b of array) {
}
for (const norest of array.map(a => (Object.assign({}, a, { x: 'a string' })))) {
[norest.x, norest.y];
// x is now a string. who knows why.
// x is now a string. who knows why.
}

View file

@ -1011,7 +1011,7 @@ var TypeScript;
ctx.path.push(cur);
}
else {
//logger.log("TODO: Ignoring node because minChar, limChar not better than previous node in stack");
//logger.log("TODO: Ignoring node because minChar, limChar not better than previous node in stack");
}
}
// The AST walker skips comments, but we might be in one, so check the pre/post comments for this node manually

View file

@ -23,7 +23,7 @@ function R1() {
function R2() { R2(); }
function R3(n) {
if (n == 0) {
//return;
//return;
}
else {
R3(n--);

View file

@ -7,9 +7,9 @@ try {
//// [sourceMap-SkippedNode.js]
try {
// ...
// ...
}
finally {
// N.B. No 'catch' block
// N.B. No 'catch' block
}
//# sourceMappingURL=sourceMap-SkippedNode.js.map

View file

@ -1,2 +1,2 @@
//// [sourceMap-SkippedNode.js.map]
{"version":3,"file":"sourceMap-SkippedNode.js","sourceRoot":"","sources":["sourceMap-SkippedNode.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC;AACL,MAAM;AACN,CAAC;QAAS,CAAC;AACX,wBAAwB;AACxB,CAAC"}
{"version":3,"file":"sourceMap-SkippedNode.js","sourceRoot":"","sources":["sourceMap-SkippedNode.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC;IACL,MAAM;AACN,CAAC;QAAS,CAAC;IACX,wBAAwB;AACxB,CAAC"}

View file

@ -12,7 +12,7 @@ sourceFile:sourceMap-SkippedNode.ts
1 >
2 >^^^^
3 > ^
4 > ^^->
4 > ^^^^^^->
1 >
2 >try
3 > {
@ -20,14 +20,14 @@ sourceFile:sourceMap-SkippedNode.ts
2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0)
---
>>>// ...
1->
2 >^^^^^^
>>> // ...
1->^^^^
2 > ^^^^^^
1->
>
2 >// ...
1->Emitted(2, 1) Source(2, 1) + SourceIndex(0)
2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0)
2 > // ...
1->Emitted(2, 5) Source(2, 1) + SourceIndex(0)
2 >Emitted(2, 11) Source(2, 7) + SourceIndex(0)
---
>>>}
1 >
@ -42,20 +42,20 @@ sourceFile:sourceMap-SkippedNode.ts
>>>finally {
1->^^^^^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^->
3 > ^^^^^^^^^^^^^^^^^^^^->
1-> finally
2 > {
1->Emitted(4, 9) Source(3, 11) + SourceIndex(0)
2 >Emitted(4, 10) Source(3, 12) + SourceIndex(0)
---
>>>// N.B. No 'catch' block
1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^
>>> // N.B. No 'catch' block
1->^^^^
2 > ^^^^^^^^^^^^^^^^^^^^^^^^
1->
>
2 >// N.B. No 'catch' block
1->Emitted(5, 1) Source(4, 1) + SourceIndex(0)
2 >Emitted(5, 25) Source(4, 25) + SourceIndex(0)
2 > // N.B. No 'catch' block
1->Emitted(5, 5) Source(4, 1) + SourceIndex(0)
2 >Emitted(5, 29) Source(4, 25) + SourceIndex(0)
---
>>>}
1 >