1
0
Fork 0
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:
Brian Fiete 2020-05-15 17:01:38 -07:00
parent 121e5b9b06
commit a1729e8297

View file

@ -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);