* Retain comments on (and produce sourcemaps on) the equals token in initializers * Improved comments/sourcemaps for await, yield, while, and for * Retain comments on block curly-braces * Emit comments for if statements * Improved switch case comment emit * Improve comment and sourcemap emit for try/catch, throw, and continue statements * Improve sourcemap emit and comments for with statements * More accurate sourcemaps+comments emit for new, typeof, void, and delete * Improve comment emit for element access expressions * Preserve more comments on imports and exports * Make function a bit more defensive like other usages of emitTrailingCommentsOfPosition * Support preserving comments within empty lists * Handle leading comments of tokens, conditionally indent leading comments * Stop heuristically sourcemapping tokens When the transform was trivial it worked, but was unneeded, but when it was complex, it was brittle - best leave source mapping up to the transformers * Fix unneeded +1 * Tighten up element access comments * Handle comments on parenthesized expression tokens * Fix nit
58 lines
742 B
TypeScript
58 lines
742 B
TypeScript
//// [for.ts]
|
|
for (var i = 0; i < 10; i++) { // ok
|
|
var x1 = i;
|
|
}
|
|
|
|
for (var j: number = 0; j < 10; j++) { // ok
|
|
var x2 = j;
|
|
}
|
|
|
|
for (var k = 0; k < 10;) { // ok
|
|
k++;
|
|
}
|
|
|
|
for (; i < 10;) { // ok
|
|
i++;
|
|
}
|
|
|
|
for (; i > 1; i--) { // ok
|
|
}
|
|
|
|
for (var l = 0; ; l++) { // ok
|
|
if (l > 10) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
for (; ;) { // ok
|
|
}
|
|
|
|
for () { // error
|
|
}
|
|
|
|
//// [for.js]
|
|
for (var i = 0; i < 10; i++) { // ok
|
|
var x1 = i;
|
|
}
|
|
for (var j = 0; j < 10; j++) { // ok
|
|
var x2 = j;
|
|
}
|
|
for (var k = 0; k < 10;) { // ok
|
|
k++;
|
|
}
|
|
for (; i < 10;) { // ok
|
|
i++;
|
|
}
|
|
for (; i > 1; i--) { // ok
|
|
}
|
|
for (var l = 0;; l++) { // ok
|
|
if (l > 10) {
|
|
break;
|
|
}
|
|
}
|
|
for (;;) { // ok
|
|
}
|
|
for (;; // error
|
|
) { // error
|
|
}
|