summaryrefslogtreecommitdiffstats
path: root/source/slang/check.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/check.cpp')
-rw-r--r--source/slang/check.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/slang/check.cpp b/source/slang/check.cpp
index 2b9abef90..b87f7c6bc 100644
--- a/source/slang/check.cpp
+++ b/source/slang/check.cpp
@@ -2128,6 +2128,12 @@ namespace Slang
RefPtr<IntVal> TryConstantFoldExpr(
ExpressionSyntaxNode* expr)
{
+ // Unwrap any "identity" expressions
+ while (auto parenExpr = dynamic_cast<ParenExpr*>(expr))
+ {
+ expr = parenExpr->base;
+ }
+
// TODO(tfoley): more serious constant folding here
if (auto constExp = dynamic_cast<ConstantExpressionSyntaxNode*>(expr))
{