1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-14 14:24:10 +02:00

Fixed autocomplete invoke info issue following struct construction

This commit is contained in:
Brian Fiete 2020-09-25 06:07:46 -07:00
parent 797aa7cedc
commit b86c0cde9e
2 changed files with 7 additions and 3 deletions

View file

@ -177,6 +177,7 @@ void BfMethodMatcher::Init(/*SizedArrayImpl<BfResolvedArg>& arguments, */BfSized
mMethodCheckCount = 0; mMethodCheckCount = 0;
mCheckedKind = BfCheckedKind_NotSet; mCheckedKind = BfCheckedKind_NotSet;
mMatchFailKind = MatchFailKind_None; mMatchFailKind = MatchFailKind_None;
mBfEvalExprFlags = BfEvalExprFlags_None;
for (auto& arg : mArguments) for (auto& arg : mArguments)
{ {
@ -1394,7 +1395,7 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* targetTypeInstance, BfTypeInst
HashSet<int> allowEmptyGenericSet; HashSet<int> allowEmptyGenericSet;
BfAutoComplete* autoComplete = NULL; BfAutoComplete* autoComplete = NULL;
if ((mModule->mCompiler->mResolvePassData != NULL) && (!isFailurePass)) if ((mModule->mCompiler->mResolvePassData != NULL) && (!isFailurePass) && ((mBfEvalExprFlags & BfEvalExprFlags_NoAutoComplete) == 0))
autoComplete = mModule->mCompiler->mResolvePassData->mAutoComplete; autoComplete = mModule->mCompiler->mResolvePassData->mAutoComplete;
if (checkMethod->mMethodType != BfMethodType_Extension) if (checkMethod->mMethodType != BfMethodType_Extension)
@ -6290,6 +6291,7 @@ BfTypedValue BfExprEvaluator::MatchConstructor(BfAstNode* targetSrc, BfMethodBou
sCtorCount++; sCtorCount++;
BfMethodMatcher methodMatcher(targetSrc, mModule, "", argValues.mResolvedArgs, NULL); BfMethodMatcher methodMatcher(targetSrc, mModule, "", argValues.mResolvedArgs, NULL);
methodMatcher.mBfEvalExprFlags = mBfEvalExprFlags;
BfTypeVector typeGenericArguments; BfTypeVector typeGenericArguments;
@ -14439,7 +14441,7 @@ void BfExprEvaluator::DoInvocation(BfAstNode* target, BfMethodBoundExpression* m
else if (expectingType->IsStruct()) else if (expectingType->IsStruct())
{ {
if ((wasCapturingMethodInfo) && (autoComplete->mMethodMatchInfo != NULL)) if ((wasCapturingMethodInfo) && (autoComplete->mMethodMatchInfo != NULL))
{ {
autoComplete->mIsCapturingMethodMatchInfo = true; autoComplete->mIsCapturingMethodMatchInfo = true;
BF_ASSERT(autoComplete->mMethodMatchInfo != NULL); BF_ASSERT(autoComplete->mMethodMatchInfo != NULL);
} }
@ -14460,7 +14462,8 @@ void BfExprEvaluator::DoInvocation(BfAstNode* target, BfMethodBoundExpression* m
} }
else else
mResult = BfTypedValue(mModule->CreateAlloca(expectingType), expectingType, BfTypedValueKind_TempAddr); mResult = BfTypedValue(mModule->CreateAlloca(expectingType), expectingType, BfTypedValueKind_TempAddr);
MatchConstructor(target, methodBoundExpr, mResult, expectingType->ToTypeInstance(), argValues, false, false);
MatchConstructor(target, methodBoundExpr, mResult, expectingType->ToTypeInstance(), argValues, false, false);
mModule->ValidateAllocation(expectingType, invocationExpr->mTarget); mModule->ValidateAllocation(expectingType, invocationExpr->mTarget);
return; return;

View file

@ -149,6 +149,7 @@ public:
bool mAllowNonStatic; bool mAllowNonStatic;
bool mSkipImplicitParams; bool mSkipImplicitParams;
bool mAutoFlushAmbiguityErrors; bool mAutoFlushAmbiguityErrors;
BfEvalExprFlags mBfEvalExprFlags;
int mMethodCheckCount; int mMethodCheckCount;
BfType* mExplicitInterfaceCheck; BfType* mExplicitInterfaceCheck;
MatchFailKind mMatchFailKind; MatchFailKind mMatchFailKind;