summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2018-04-02 18:39:15 -0700
committerGitHub <noreply@github.com>2018-04-02 18:39:15 -0700
commit499e2586cba2a7ba2a703b90c459b24620e351ee (patch)
tree15ef2e628e15aefec19bfc75b1f90610fa3e1f70 /source
parent38d5ef4764e9271ce2360f42b0759a236cddd9fe (diff)
Implement "operator comma" in IR codegen (#472)
Fixes #471
Diffstat (limited to 'source')
-rw-r--r--source/slang/lower-to-ir.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/slang/lower-to-ir.cpp b/source/slang/lower-to-ir.cpp
index 57fa55741..5f8428698 100644
--- a/source/slang/lower-to-ir.cpp
+++ b/source/slang/lower-to-ir.cpp
@@ -681,6 +681,15 @@ LoweredValInfo emitCallToDeclRef(
case kIRPseudoOp_Pos:
return LoweredValInfo::simple(args[0]);
+ case kIRPseudoOp_Sequence:
+ // The main effect of "operator comma" is to enforce
+ // sequencing of its operands, but Slang already
+ // implements a strictly left-to-right evaluation
+ // order for function arguments, so in practice we
+ // just need to compile `a, b` to the value of `b`
+ // (because argument evaluation already happened).
+ return LoweredValInfo::simple(args[1]);
+
#define CASE(COMPOUND, OP) \
case COMPOUND: return emitCompoundAssignOp(context, type, OP, argCount, args)