1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 20:12:21 +02:00

Fixed methodRef lambdas with outer generics

This commit is contained in:
Brian Fiete 2020-05-08 07:07:47 -07:00
parent e90e8aee47
commit 44bd9c698f

View file

@ -18006,18 +18006,18 @@ BfMethodDef* BfModule::GetLocalMethodDef(BfLocalMethod* localMethod)
BfMethodDef* methodDef; BfMethodDef* methodDef;
if (methodDeclaration != NULL)
{
BfDefBuilder defBuilder(mCompiler->mSystem);
defBuilder.mPassInstance = mCompiler->mPassInstance;
defBuilder.mCurTypeDef = mCurMethodInstance->mMethodDef->mDeclaringType;
BfMethodDef* outerMethodDef = NULL; BfMethodDef* outerMethodDef = NULL;
if (localMethod->mOuterLocalMethod != NULL) if (localMethod->mOuterLocalMethod != NULL)
outerMethodDef = localMethod->mOuterLocalMethod->mMethodDef; outerMethodDef = localMethod->mOuterLocalMethod->mMethodDef;
else else
outerMethodDef = rootMethodState->mMethodInstance->mMethodDef; outerMethodDef = rootMethodState->mMethodInstance->mMethodDef;
if (methodDeclaration != NULL)
{
BfDefBuilder defBuilder(mCompiler->mSystem);
defBuilder.mPassInstance = mCompiler->mPassInstance;
defBuilder.mCurTypeDef = mCurMethodInstance->mMethodDef->mDeclaringType;
methodDef = defBuilder.CreateMethodDef(methodDeclaration, outerMethodDef); methodDef = defBuilder.CreateMethodDef(methodDeclaration, outerMethodDef);
} }
else else
@ -18044,6 +18044,16 @@ BfMethodDef* BfModule::GetLocalMethodDef(BfLocalMethod* localMethod)
paramDef->mName = paramName; paramDef->mName = paramName;
methodDef->mParams.Add(paramDef); methodDef->mParams.Add(paramDef);
} }
if (outerMethodDef != NULL)
{
for (auto genericParam : outerMethodDef->mGenericParams)
{
auto* copiedGenericParamDef = new BfGenericParamDef();
*copiedGenericParamDef = *genericParam;
methodDef->mGenericParams.Add(copiedGenericParamDef);
}
}
} }
methodDef->mIdx = ~methodLocalIdx; methodDef->mIdx = ~methodLocalIdx;