diff options
Diffstat (limited to 'source/slang/emit.cpp')
| -rw-r--r-- | source/slang/emit.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 914aea7fd..71b961616 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -3002,9 +3002,19 @@ struct EmitVisitor } else { + // If it returns void -> then we don't need parenthesis + + const auto returnType = inst->getDataType(); + const bool isVoid = as<IRVoidType>(returnType) != nullptr; + + // We could determine here is the return type is void... if so no braces? + // General case: we are going to emit some more complex text. - Emit("("); + if (!isVoid) + { + Emit("("); + } char const* cursor = name.begin(); char const* end = name.end(); @@ -3364,7 +3374,10 @@ struct EmitVisitor } } - Emit(")"); + if (!isVoid) + { + Emit(")"); + } } } |
