From 499e2586cba2a7ba2a703b90c459b24620e351ee Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Mon, 2 Apr 2018 18:39:15 -0700 Subject: Implement "operator comma" in IR codegen (#472) Fixes #471 --- source/slang/lower-to-ir.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source') 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) -- cgit v1.2.3