diff options
| author | Yong He <yonghe@outlook.com> | 2020-07-16 13:09:17 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-16 13:09:17 -0700 |
| commit | 62079c534407abe300d24a6d759641779e48bc67 (patch) | |
| tree | e00e89f76194493e5ba425c866a8e59a5fd1925c /source/slang/slang-ir-lower-generic-function.cpp | |
| parent | 5758d16612eda0f902d7d4c02535afe44dec2ac2 (diff) | |
Support associatedtype local variables and return values in dynamic dispatch code (#1444)
* Refactor lower-generics pass into separate subpasses.
* IR pass to generate witness table wrappers.
* Support associatedtype local variables and return values in dynamic dispatch code.
Diffstat (limited to 'source/slang/slang-ir-lower-generic-function.cpp')
| -rw-r--r-- | source/slang/slang-ir-lower-generic-function.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/slang/slang-ir-lower-generic-function.cpp b/source/slang/slang-ir-lower-generic-function.cpp index e930c6cc8..92f00c509 100644 --- a/source/slang/slang-ir-lower-generic-function.cpp +++ b/source/slang/slang-ir-lower-generic-function.cpp @@ -122,7 +122,8 @@ namespace Slang auto paramType = param->getDataType(); if (auto ptrType = as<IRPtrTypeBase>(paramType)) paramType = ptrType->getValueType(); - if (isPointerOfType(paramType->getDataType(), kIROp_RTTIType)) + if (isPointerOfType(paramType->getDataType(), kIROp_RTTIType) || + paramType->op == kIROp_lookup_interface_method) { // Lower into a function parameter of raw pointer type. param->setFullType(builder.getRawPointerType()); @@ -277,6 +278,7 @@ namespace Slang // Update the type of lookupInst to the lowered type of the corresponding interface requirement val. // If the requirement is a function, interfaceRequirementVal will be the lowered function type. + // If the requirement is an associatedtype, interfaceRequirementVal will be Ptr<RTTIObject>. IRInst* interfaceRequirementVal = nullptr; auto witnessTableType = cast<IRWitnessTableType>(lookupInst->getWitnessTable()->getDataType()); auto interfaceType = maybeLowerInterfaceType(cast<IRInterfaceType>(witnessTableType->getConformanceType())); |
