diff options
| author | Yong He <yonghe@outlook.com> | 2024-03-26 17:35:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-26 17:35:24 -0700 |
| commit | dfdf243f07c977fa59b1a5968ce053bf590f8120 (patch) | |
| tree | 6121218f9e4d664722ed6192ca08f7c0e3c1d45b /source/slang/slang-lower-to-ir.cpp | |
| parent | 0877d1a3e9d69fdbf4087581df96954e56e4dd97 (diff) | |
Support mutable existential parameters. (#3836)
* Support mutable existential parameters.
* Update test.
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index 41638dc83..799faec88 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -2503,6 +2503,7 @@ void addArg( LoweredValInfo argVal, //< The lowered value of the argument to add IRType* paramType, //< The type of the corresponding parameter ParameterDirection paramDirection, //< The direction of the parameter (`in`, `out`, etc.) + Type* argType, //< The AST-level type of the argument SourceLoc loc) //< A location to use if we need to report an error { switch(paramDirection) @@ -2543,6 +2544,12 @@ void addArg( // If the value is not one that could yield a simple l-value // then we need to convert it into a temporary // + if (as<IRThisType>(paramType)) + { + // When paramType is ThisType, we need to get the actual argument type + // from the arg. + paramType = lowerType(context, argType); + } if (auto refType = as<IRConstRefType>(paramType)) { paramType = refType->getValueType(); @@ -2616,7 +2623,7 @@ void addCallArgsForParam( case kParameterDirection_InOut: { LoweredValInfo loweredArg = lowerLValueExpr(context, argExpr); - addArg(context, ioArgs, ioFixups, loweredArg, paramType, paramDirection, argExpr->loc); + addArg(context, ioArgs, ioFixups, loweredArg, paramType, paramDirection, argExpr->type, argExpr->loc); } break; @@ -3223,7 +3230,7 @@ static LoweredValInfo _emitCallToAccessor( auto thisParam = info.parameterLists.params[0]; auto thisParamType = lowerType(context, thisParam.type); - addArg(context, &allArgs, &fixups, base, thisParamType, thisParam.direction, SourceLoc()); + addArg(context, &allArgs, &fixups, base, thisParamType, thisParam.direction, thisParam.type, SourceLoc()); } allArgs.addRange(args, argCount); |
