mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Made static lookup for with generic constraints
This commit is contained in:
parent
121e5b9b06
commit
a1729e8297
1 changed files with 18 additions and 0 deletions
|
@ -7768,6 +7768,24 @@ void BfExprEvaluator::LookupQualifiedStaticField(BfAstNode* nameNode, BfIdentifi
|
|||
else
|
||||
lookupType = BfTypedValue(type);
|
||||
auto findName = nameRight->ToString();
|
||||
|
||||
if ((lookupType.mType != NULL) && (lookupType.mType->IsGenericParam()))
|
||||
{
|
||||
auto genericParamInstance = mModule->GetGenericParamInstance((BfGenericParamType*)lookupType.mType);
|
||||
if (genericParamInstance->mTypeConstraint != NULL)
|
||||
{
|
||||
mResult = LookupField(nameRight, BfTypedValue(genericParamInstance->mTypeConstraint), findName);
|
||||
if ((mResult) || (mPropDef != NULL))
|
||||
return;
|
||||
}
|
||||
for (auto constraint : genericParamInstance->mInterfaceConstraints)
|
||||
{
|
||||
mResult = LookupField(nameRight, BfTypedValue(constraint), findName);
|
||||
if ((mResult) || (mPropDef != NULL))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*if (findName == "base")
|
||||
{
|
||||
mResult = BfTypedValue(lookupType);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue