diff options
| author | Yong He <yonghe@outlook.com> | 2022-09-05 00:38:45 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-05 00:38:45 -0700 |
| commit | ea0845285b0307d153a91d6f0a5010fc2d7219ed (patch) | |
| tree | bf2d8f7258b2681deddf3391c551c5ff2b1a7918 /source/slang/slang-lower-to-ir.cpp | |
| parent | 2a869c105dcc23ede8f5e6e16b08261f45aa5aad (diff) | |
Multi parameter `__subscript` (#2392)
* Multi parameter `__subscript`
* Fix.
* Fix bugs.
* Fix.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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<Derived, LoweredValInfo> { 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<DeclLoweringVisitor, LoweredValInfo> // 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)); |
