diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2017-07-17 10:27:52 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-17 10:27:52 -0700 |
| commit | 0b4992fb69e359a7e566cca42331a196904556f5 (patch) | |
| tree | 687ae0e64e7b2cc4624e785f76b6ee8061e3ba20 /source/slang/emit.cpp | |
| parent | c69060a75c20ee60b891622f0acd9ed598cb468e (diff) | |
| parent | 782e6f0f675fd858acfdc66e5ea1fa46a646df71 (diff) | |
Merge pull request #108 from tfoleyNV/gh-105
Don't crash-fail on errors in entry point parameters
Diffstat (limited to 'source/slang/emit.cpp')
| -rw-r--r-- | source/slang/emit.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 7ffce2acd..8c6a46196 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -1495,14 +1495,28 @@ struct EmitVisitor outerPrec.rightPrecedence = rightPrec; } + void visitGenericAppExpr(GenericAppExpr* expr, ExprEmitArg const& arg) + { + auto prec = kEOp_Postfix; + auto outerPrec = arg.outerPrec; + bool needClose = MaybeEmitParens(outerPrec, prec); -#define UNEXPECTED(NAME) \ - void visit##NAME(NAME*, ExprEmitArg const&) \ - { Emit(#NAME); } - - UNEXPECTED(GenericAppExpr); + EmitExprWithPrecedence(expr->FunctionExpr, leftSide(outerPrec, prec)); + Emit("<"); + bool first = true; + for(auto aa : expr->Arguments) + { + if(!first) Emit(", "); + EmitExpr(aa); + first = false; + } + Emit(" >"); -#undef UNEXPECTED + if(needClose) + { + Emit(")"); + } + } void visitSharedTypeExpr(SharedTypeExpr* expr, ExprEmitArg const&) { |
