diff options
| author | Yong He <yonghe@outlook.com> | 2017-10-30 19:31:52 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-30 19:31:52 -0400 |
| commit | 832d9c708891b10145c6648d893b04ca4a0b879a (patch) | |
| tree | e1f44fc27bf80d94de5ac0e866c7409b2adcec22 /source/slang/emit.cpp | |
| parent | c24c173101c2c124401af77d8c513a23efac3b7e (diff) | |
| parent | 3ffdf610d05a9318731bd7237da530c3d312a9a9 (diff) | |
Merge pull request #235 from tfoleyNV/explicit-this-expr
Support `this` expressions (explicit and implicit)
Diffstat (limited to 'source/slang/emit.cpp')
| -rw-r--r-- | source/slang/emit.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index d433d5e2f..2e8ab58d4 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -2395,6 +2395,17 @@ struct EmitVisitor if(needClose) Emit(")"); } + void visitThisExpr(ThisExpr* expr, ExprEmitArg const& arg) + { + auto prec = kEOp_Atomic; + auto outerPrec = arg.outerPrec; + bool needClose = MaybeEmitParens(outerPrec, prec); + + Emit("this"); + + if(needClose) Emit(")"); + } + void visitSwizzleExpr(SwizzleExpr* swizExpr, ExprEmitArg const& arg) { auto prec = kEOp_Postfix; |
