mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
More methodref fixes
This commit is contained in:
parent
b16f8b303e
commit
4449952235
3 changed files with 25 additions and 10 deletions
|
@ -1069,7 +1069,6 @@ BfTypedValue BfMethodMatcher::ResolveArgTypedValue(BfResolvedArg& resolvedArg, B
|
|||
BfTypedValue argTypedValue = resolvedArg.mTypedValue;
|
||||
if ((resolvedArg.mArgFlags & BfArgFlag_DelegateBindAttempt) != 0)
|
||||
{
|
||||
//TODO: See if we can bind it to a delegate type
|
||||
BfExprEvaluator exprEvaluator(mModule);
|
||||
exprEvaluator.mExpectingType = checkType;
|
||||
BF_ASSERT(resolvedArg.mExpression->IsA<BfDelegateBindExpression>());
|
||||
|
@ -1083,6 +1082,10 @@ BfTypedValue BfMethodMatcher::ResolveArgTypedValue(BfResolvedArg& resolvedArg, B
|
|||
{
|
||||
return BfTypedValue(mModule->mBfIRBuilder->GetFakeVal(), boundMethodInstance->GetOwner());
|
||||
}
|
||||
else if (boundMethodInstance->mDisallowCalling)
|
||||
{
|
||||
argTypedValue = BfTypedValue(mModule->mBfIRBuilder->GetFakeVal(), checkType);
|
||||
}
|
||||
else
|
||||
{
|
||||
resolvedArg.mExpectedType = checkType;
|
||||
|
@ -10378,6 +10381,13 @@ void BfExprEvaluator::Visit(BfDelegateBindExpression* delegateBindExpr)
|
|||
return;
|
||||
}
|
||||
|
||||
if (bindResult.mMethodInstance->mDisallowCalling)
|
||||
{
|
||||
BF_ASSERT(mModule->mBfIRBuilder->mIgnoreWrites);
|
||||
mResult = mModule->GetDefaultTypedValue(mExpectingType, false, BfDefaultValueKind_Addr);
|
||||
return;
|
||||
}
|
||||
|
||||
auto methodRefType = mModule->CreateMethodRefType(bindResult.mMethodInstance);
|
||||
mModule->AddDependency(methodRefType, mModule->mCurTypeInstance, BfDependencyMap::DependencyFlag_Calls);
|
||||
mModule->AddCallDependency(bindResult.mMethodInstance);
|
||||
|
@ -10931,12 +10941,6 @@ BfLambdaInstance* BfExprEvaluator::GetLambdaInstance(BfLambdaBindExpression* lam
|
|||
|
||||
if (invokeMethodInstance != NULL)
|
||||
{
|
||||
if (mModule->mBfIRBuilder->mIgnoreWrites)
|
||||
{
|
||||
mResult = mModule->GetDefaultTypedValue(mExpectingType, false, BfDefaultValueKind_Addr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BfLocalMethod* localMethod = new BfLocalMethod();
|
||||
localMethod->mMethodName = "anon";
|
||||
localMethod->mSystem = mModule->mSystem;
|
||||
|
@ -10951,6 +10955,12 @@ BfLambdaInstance* BfExprEvaluator::GetLambdaInstance(BfLambdaBindExpression* lam
|
|||
|
||||
auto moduleMethodInstance = mModule->GetLocalMethodInstance(localMethod, BfTypeVector());
|
||||
|
||||
if (moduleMethodInstance.mMethodInstance->mDisallowCalling)
|
||||
{
|
||||
mResult = mModule->GetDefaultTypedValue(mExpectingType, false, BfDefaultValueKind_Addr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
auto methodRefType = mModule->CreateMethodRefType(moduleMethodInstance.mMethodInstance);
|
||||
mModule->AddDependency(methodRefType, mModule->mCurTypeInstance, BfDependencyMap::DependencyFlag_Calls);
|
||||
mModule->AddCallDependency(moduleMethodInstance.mMethodInstance);
|
||||
|
|
|
@ -19694,6 +19694,8 @@ BfModuleMethodInstance BfModule::GetLocalMethodInstance(BfLocalMethod* localMeth
|
|||
BfDeferredLocalAssignData deferredLocalAssignData(rootMethodState->mCurScope);
|
||||
deferredLocalAssignData.mVarIdBarrier = rootMethodState->mCurLocalVarId;
|
||||
SetAndRestoreValue<BfDeferredLocalAssignData*> prevDLA(rootMethodState->mDeferredLocalAssignData, &deferredLocalAssignData);
|
||||
if (!mIgnoreErrors)
|
||||
localMethod->mDidBodyErrorPass = true;
|
||||
|
||||
_VisitLambdaBody();
|
||||
RestoreScopeState();
|
||||
|
@ -19907,7 +19909,8 @@ BfModuleMethodInstance BfModule::GetLocalMethodInstance(BfLocalMethod* localMeth
|
|||
|
||||
// Since we handle errors & warnings in the capture phase, we don't need to process any local methods for resolve-only (unless we're doing a mDbgVerifyCodeGen)
|
||||
if ((!localMethod->mDeclOnly) && (!methodInstance->IsOrInUnspecializedVariation()) &&
|
||||
(!mWantsIRIgnoreWrites) && (methodDef->mMethodType != BfMethodType_Mixin))
|
||||
(methodDef->mMethodType != BfMethodType_Mixin) &&
|
||||
((!mWantsIRIgnoreWrites) || (!localMethod->mDidBodyErrorPass)))
|
||||
{
|
||||
BP_ZONE("BfDeferredLocalMethod:create");
|
||||
|
||||
|
|
|
@ -220,6 +220,7 @@ public:
|
|||
BfMixinState* mDeclMixinState;
|
||||
OwnedVector<BfDirectTypeReference> mDirectTypeRefs;
|
||||
bool mDeclOnly;
|
||||
bool mDidBodyErrorPass;
|
||||
BfLocalMethod* mNextWithSameName;
|
||||
|
||||
public:
|
||||
|
@ -237,6 +238,7 @@ public:
|
|||
mDeclMethodState = NULL;
|
||||
mDeclMixinState = NULL;
|
||||
mDeclOnly = false;
|
||||
mDidBodyErrorPass = false;
|
||||
mNextWithSameName = NULL;
|
||||
}
|
||||
~BfLocalMethod();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue