diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2017-10-30 13:47:04 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-30 13:47:04 -0700 |
| commit | 3ffdf610d05a9318731bd7237da530c3d312a9a9 (patch) | |
| tree | e1f44fc27bf80d94de5ac0e866c7409b2adcec22 /source | |
| parent | 11f44241ffef478560eaba79af330c16f0bc8d69 (diff) | |
| parent | c24c173101c2c124401af77d8c513a23efac3b7e (diff) | |
Merge branch 'master' into explicit-this-expr
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/emit.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 38e7376df..2e8ab58d4 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); |
