Emit comments for if statement
This commit is contained in:
parent
6036c92784
commit
0a75cc2926
|
@ -924,10 +924,6 @@ module ts {
|
|||
}
|
||||
|
||||
function emitIfStatement(node: IfStatement) {
|
||||
// emit comments only if this is not else if statement as else if will take care of emitting the leading/trailing comments
|
||||
if (node.parent.kind !== SyntaxKind.IfStatement || (<IfStatement>node.parent).elseStatement !== node) {
|
||||
emitLeadingComments(node);
|
||||
}
|
||||
emitLeadingComments(node);
|
||||
var endPos = emitToken(SyntaxKind.IfKeyword, node.pos);
|
||||
write(" ");
|
||||
|
@ -937,7 +933,6 @@ module ts {
|
|||
emitEmbeddedStatement(node.thenStatement);
|
||||
if (node.elseStatement) {
|
||||
writeLine();
|
||||
emitLeadingComments(node.elseStatement);
|
||||
emitToken(SyntaxKind.ElseKeyword, node.thenStatement.end);
|
||||
if (node.elseStatement.kind === SyntaxKind.IfStatement) {
|
||||
write(" ");
|
||||
|
|
|
@ -5,5 +5,6 @@ if (true) {
|
|||
}
|
||||
|
||||
//// [commentOnIfStatement1.js]
|
||||
// Test
|
||||
if (true) {
|
||||
}
|
||||
|
|
|
@ -218,6 +218,7 @@ var N;
|
|||
}
|
||||
N.F2 = F2;
|
||||
})(N || (N = {}));
|
||||
// literals
|
||||
if (true) {
|
||||
}
|
||||
while (true) {
|
||||
|
|
|
@ -20,6 +20,7 @@ var foo;
|
|||
})(foo || (foo = {}));
|
||||
//// [foo_1.js]
|
||||
define(["require", "exports", "./foo_0"], function (require, exports, foo) {
|
||||
// Import should fail. foo_0 not an external module
|
||||
if (foo.answer === 42) {
|
||||
}
|
||||
});
|
||||
|
|
|
@ -19,5 +19,6 @@ var s = (null);
|
|||
var b = (n);
|
||||
function isVoid() {
|
||||
}
|
||||
// Expected error: Values of type null and void cannot be compared
|
||||
if (null === isVoid()) {
|
||||
}
|
||||
|
|
|
@ -12,5 +12,6 @@ if (!null !== true) {
|
|||
//// [voidAsOperator.js]
|
||||
if (!void 0 !== true) {
|
||||
}
|
||||
//CHECK#2
|
||||
if (!null !== true) {
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue