Trailing comment tests for parameters, fixes the trailing // comments and parameter indentation

This commit is contained in:
Sheetal Nandi
2014-08-15 13:18:54 -07:00
parent 1b64519d52
commit 3dd21fc3a7
391 changed files with 1600 additions and 1565 deletions
+4 -4
View File
@@ -1204,13 +1204,13 @@ module ts {
}
function emitSignatureParameters(node: FunctionDeclaration) {
increaseIndent();
write("(");
if (node) {
increaseIndent();
emitCommaList(node.parameters, node.parameters.length - (hasRestParameters(node) ? 1 : 0));
decreaseIndent();
}
write(")");
decreaseIndent();
}
function emitSignatureAndBody(node: FunctionDeclaration) {
@@ -1386,8 +1386,8 @@ module ts {
write("function ");
emitSignatureAndBody(accessors.getAccessor);
emitEnd(accessors.getAccessor);
write(",");
emitTrailingComments(accessors.getAccessor);
write(",");
}
if (accessors.setAccessor) {
writeLine();
@@ -1397,8 +1397,8 @@ module ts {
write("function ");
emitSignatureAndBody(accessors.setAccessor);
emitEnd(accessors.setAccessor);
write(",");
emitTrailingComments(accessors.setAccessor);
write(",");
}
writeLine();
write("enumerable: true,");
+3 -1
View File
@@ -385,12 +385,14 @@ module ts {
continue;
case CharacterCodes.slash:
var nextChar = text.charCodeAt(pos + 1);
var hasTrailingNewLine = false;
if (nextChar === CharacterCodes.slash || nextChar === CharacterCodes.asterisk) {
var startPos = pos;
pos += 2;
if (nextChar === CharacterCodes.slash) {
while (pos < text.length) {
if (isLineBreak(text.charCodeAt(pos))) {
hasTrailingNewLine = true;
break;
}
pos++;
@@ -407,7 +409,7 @@ module ts {
}
if (collecting) {
if (!result) result = [];
result.push({ pos: startPos, end: pos });
result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine });
}
continue;
}