From ea0845285b0307d153a91d6f0a5010fc2d7219ed Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 5 Sep 2022 00:38:45 -0700 Subject: Multi parameter `__subscript` (#2392) * Multi parameter `__subscript` * Fix. * Fix bugs. * Fix. Co-authored-by: Yong He --- source/slang/slang-lower-to-ir.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (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 31472e878..95d2c1cd7 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -3073,7 +3073,10 @@ struct ExprLoweringVisitorBase : ExprVisitor { auto type = lowerType(context, expr->type); auto baseVal = lowerSubExpr(expr->baseExpression); - auto indexVal = getSimpleVal(context, lowerRValueExpr(context, expr->indexExpression)); + + SLANG_RELEASE_ASSERT(expr->indexExprs.getCount() == 1); + + auto indexVal = getSimpleVal(context, lowerRValueExpr(context, expr->indexExprs[0])); return subscriptValue(type, baseVal, indexVal); } @@ -6714,7 +6717,7 @@ struct DeclLoweringVisitor : DeclVisitor // Allocate an IRInterfaceType with the `operandCount` operands. IRInterfaceType* irInterface = subBuilder->createInterfaceType(operandCount, nullptr); - + // Add `irInterface` to decl mapping now to prevent cyclic lowering. setValue(subContext, decl, LoweredValInfo::simple(irInterface)); -- cgit v1.2.3