summaryrefslogtreecommitdiffstats
path: root/source/slang/emit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/emit.cpp')
-rw-r--r--source/slang/emit.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index 6b411a25d..d433d5e2f 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -1563,6 +1563,20 @@ struct EmitVisitor
Emit(")");
}
+ void emitTypeOrExpr(
+ Type* type,
+ Expr* expr)
+ {
+ if (type && !type->As<ErrorType>())
+ {
+ EmitType(type);
+ }
+ else
+ {
+ emitTypeBasedOnExpr(expr, nullptr);
+ }
+ }
+
void emitSimpleConstructorCallExpr(
RefPtr<InvokeExpr> callExpr,
EOpInfo outerPrec)
@@ -1576,7 +1590,7 @@ struct EmitVisitor
bool needClose = MaybeEmitParens(outerPrec, prec);
Emit("(");
- EmitType(callExpr->type);
+ emitTypeOrExpr(callExpr->type.type, callExpr->FunctionExpr);
Emit(") ");
EmitExprWithPrecedence(callExpr->Arguments[0], rightSide(outerPrec, prec));
@@ -1592,7 +1606,7 @@ struct EmitVisitor
auto prec = kEOp_Postfix;
bool needClose = MaybeEmitParens(outerPrec, prec);
- EmitType(callExpr->type);
+ emitTypeOrExpr(callExpr->type.type, callExpr->FunctionExpr);
emitSimpleCallArgs(callExpr);