diff options
| author | Yong He <yonghe@outlook.com> | 2019-01-28 09:42:27 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-28 09:42:27 -0800 |
| commit | 71f1750dea041cb19eb6f25def585085dd171915 (patch) | |
| tree | fe9c11d126e8ee656726d92ff55d6be1e81c45c5 /source/slang/emit.cpp | |
| parent | eefe2539373a2e17eda2f11c420908c0aebcac6d (diff) | |
| parent | df9dc5710725d00630831b77ca7005e390383aa6 (diff) | |
Merge branch 'master' into texture-fix
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 536c72e11..dd6feb50d 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(")"); + } } } |
