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.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/slang/check.cpp b/source/slang/check.cpp
index f21f9480c..556f141c0 100644
--- a/source/slang/check.cpp
+++ b/source/slang/check.cpp
@@ -987,7 +987,19 @@ namespace Slang
RefPtr<ExpressionType> toType,
RefPtr<ExpressionSyntaxNode> fromExpr)
{
- auto castExpr = new ImplicitCastExpr();
+ // In "rewrite" mode, we will generate a different syntax node
+ // to indicate that this type-cast was implicitly generated
+ // by the compiler, and shouldn't appear in the output code.
+ RefPtr<TypeCastExpressionSyntaxNode> castExpr;
+ if (isRewriteMode())
+ {
+ castExpr = new HiddenImplicitCastExpr();
+ }
+ else
+ {
+ castExpr = new ImplicitCastExpr();
+ }
+
castExpr->Position = fromExpr->Position;
castExpr->TargetType.type = toType;
castExpr->Type = QualType(toType);