Skip to content

Commit

Permalink
Protect against invalid fixit for adding method
Browse files Browse the repository at this point in the history
  • Loading branch information
bfiete committed Sep 10, 2020
1 parent be093b6 commit c34e6fe
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions IDEHelper/Compiler/BfExprEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7529,15 +7529,17 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp
if (targetType != NULL)
{
auto typeInst = targetType->ToTypeInstance();

BfTypeVector paramTypes;
for (int argIdx = 0; argIdx < (int)argValues.mResolvedArgs.size(); argIdx++)
if ((targetType != NULL) && (!methodName.IsEmpty()))
{
auto& resolvedArg = argValues.mResolvedArgs[argIdx];
paramTypes.Add(resolvedArg.mTypedValue.mType);
}
BfTypeVector paramTypes;
for (int argIdx = 0; argIdx < (int)argValues.mResolvedArgs.size(); argIdx++)
{
auto& resolvedArg = argValues.mResolvedArgs[argIdx];
paramTypes.Add(resolvedArg.mTypedValue.mType);
}

autoComplete->FixitAddMethod(typeInst, methodName, mExpectingType, paramTypes, wantStatic);
autoComplete->FixitAddMethod(typeInst, methodName, mExpectingType, paramTypes, wantStatic);
}
}
}

Expand Down

0 comments on commit c34e6fe

Please sign in to comment.