C++ compiler.
Don't compile commented out code.
This commit is contained in:
Родитель
50094939e8
Коммит
77e39ec5ea
|
@ -150,14 +150,19 @@ module TDev {
|
|||
elseBranch: J.JStmt[],
|
||||
isElseIf: boolean)
|
||||
{
|
||||
return [
|
||||
env.indent, isElseIf ? "else " : "", "if (" + this.visit(env, cond) + "){\n",
|
||||
this.visitMany(indent(env), thenBranch) + "\n",
|
||||
env.indent, "}",
|
||||
elseBranch ? " else {\n" : "",
|
||||
elseBranch ? this.visitMany(indent(env), elseBranch) + "\n" : "",
|
||||
elseBranch ? env.indent + "}" : ""
|
||||
].join("");
|
||||
// TouchDevelop abuses "if false" to comment out code. Commented out
|
||||
// code is not type-checked, so don't try to compile it.
|
||||
if (cond.tree.nodeType == "booleanLiteral" && (<J.JBooleanLiteral> cond.tree).value === false)
|
||||
return "";
|
||||
else
|
||||
return [
|
||||
env.indent, isElseIf ? "else " : "", "if (" + this.visit(env, cond) + "){\n",
|
||||
this.visitMany(indent(env), thenBranch) + "\n",
|
||||
env.indent, "}",
|
||||
elseBranch ? " else {\n" : "",
|
||||
elseBranch ? this.visitMany(indent(env), elseBranch) + "\n" : "",
|
||||
elseBranch ? env.indent + "}" : ""
|
||||
].join("");
|
||||
}
|
||||
|
||||
private resolveCall(env: EmitterEnv, receiver: J.JExpr, name: string) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче