From faf042ecc3e688a1a3ffbe1ac44d18dd7ddf441a Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 29 May 2025 08:05:57 -0700 Subject: Language version + tuple syntax. (#7230) * Language version + tuple syntax. * Fix compile error. * regenerate documentation Table of Contents * Fix. * regenerate command line reference * Fix. * Fix. * Fix more test failures. * revert empty line change, * Retrigger CI * #version->#lang * Update source/core/slang-type-text-util.cpp Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> * Remove comments. * Fix parsing logic. * Fix parser. * Fix parser. * update test comment * Update options. * regenerate documentation Table of Contents * regenerate command line reference --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> --- source/slang/slang-lower-to-ir.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'source/slang/slang-lower-to-ir.cpp') diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index ebcdaf1e1..758b21e93 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -4668,6 +4668,29 @@ struct ExprLoweringVisitorBase : public ExprVisitor LoweredValInfo visitParenExpr(ParenExpr* expr) { return lowerSubExpr(expr->base); } + LoweredValInfo visitTupleExpr(TupleExpr* expr) + { + List elements; + for (auto element : expr->elements) + { + auto elementVal = getSimpleVal(context, lowerSubExpr(element)); + if (auto makeValPack = as(elementVal)) + { + // If the element is a value pack, we need to flatten it out + // into the tuple. + for (UInt i = 0; i < makeValPack->getOperandCount(); ++i) + { + elements.add(makeValPack->getOperand(i)); + } + continue; + } + elements.add(elementVal); + } + auto irMakeTuple = + getBuilder()->emitMakeTuple((UInt)elements.getCount(), elements.getBuffer()); + return LoweredValInfo::simple(irMakeTuple); + } + LoweredValInfo visitPackExpr(PackExpr* expr) { List irArgs; -- cgit v1.2.3