Skip to content

Commit

Permalink
Compiler: Don't unscope const if
Browse files Browse the repository at this point in the history
  • Loading branch information
SirLynix committed Jul 27, 2024
1 parent e028a84 commit e90287a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/NZSL/Ast/SanitizeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1268,12 +1268,12 @@ namespace nzsl::Ast
throw CompilerConditionExpectedBoolError{ cond.condition->sourceLocation, ToString(GetConstantType(*conditionValue), cond.condition->sourceLocation) };

if (std::get<bool>(*conditionValue))
return Unscope(Cloner::Clone(*cond.statement));
return Cloner::Clone(*cond.statement);
}

// Every condition failed, fallback to else if any
if (node.elseStatement)
return Unscope(Cloner::Clone(*node.elseStatement));
return Cloner::Clone(*node.elseStatement);
else
return ShaderBuilder::NoOp();
}
Expand Down

0 comments on commit e90287a

Please sign in to comment.