(stmt: o.IfStmt, ctx: EmitterVisitorContext)
| 239 | } |
| 240 | |
| 241 | visitIfStmt(stmt: o.IfStmt, ctx: EmitterVisitorContext): void { |
| 242 | this.printLeadingComments(stmt, ctx); |
| 243 | ctx.print(stmt, `if (`); |
| 244 | this.lastIfCondition = stmt.condition; // We can skip redundant parentheses for the condition. |
| 245 | stmt.condition.visitExpression(this, ctx); |
| 246 | this.lastIfCondition = null; |
| 247 | ctx.print(stmt, `) {`); |
| 248 | const hasElseCase = stmt.falseCase != null && stmt.falseCase.length > 0; |
| 249 | if (stmt.trueCase.length <= 1 && !hasElseCase) { |
| 250 | ctx.print(stmt, ` `); |
| 251 | this.visitAllStatements(stmt.trueCase, ctx); |
| 252 | ctx.removeEmptyLastLine(); |
| 253 | ctx.print(stmt, ` `); |
| 254 | } else { |
| 255 | ctx.println(); |
| 256 | ctx.incIndent(); |
| 257 | this.visitAllStatements(stmt.trueCase, ctx); |
| 258 | ctx.decIndent(); |
| 259 | if (hasElseCase) { |
| 260 | ctx.println(stmt, `} else {`); |
| 261 | ctx.incIndent(); |
| 262 | this.visitAllStatements(stmt.falseCase, ctx); |
| 263 | ctx.decIndent(); |
| 264 | } |
| 265 | } |
| 266 | ctx.println(stmt, `}`); |
| 267 | } |
| 268 | |
| 269 | visitDeclareVarStmt(stmt: o.DeclareVarStmt, ctx: EmitterVisitorContext): void { |
| 270 | const varKind = stmt.hasModifier(o.StmtModifier.Final) ? 'const' : 'let'; |
nothing calls this directly
no test coverage detected
searching dependent graphs…