MCPcopy Create free account
hub / github.com/beefytech/Beef / CheckInvocation

Method CheckInvocation

IDEHelper/Compiler/BfAutoComplete.cpp:2389–2472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2387}
2388
2389void BfAutoComplete::CheckInvocation(BfAstNode* invocationNode, BfTokenNode* openParen, BfTokenNode* closeParen, const BfSizedArray<ASTREF(BfTokenNode*)>& commas)
2390{
2391 if (!mIsAutoComplete)
2392 return;
2393
2394 bool wasCapturingMethodMatchInfo = mIsCapturingMethodMatchInfo;
2395 mIsCapturingMethodMatchInfo = false;
2396
2397 int lenAdd = 0;
2398 if (closeParen == NULL)
2399 {
2400 // Unterminated invocation expression - allow for space after last comma in param list
2401 lenAdd = 1;
2402 }
2403 else
2404 {
2405 // Ignore close paren
2406 lenAdd = -1;
2407 }
2408
2409 if (!IsAutocompleteNode(invocationNode, lenAdd))
2410 return;
2411
2412 if (openParen == NULL)
2413 {
2414 mModule->AssertErrorState();
2415 return;
2416 }
2417
2418 auto bfParser = invocationNode->GetSourceData()->ToParser();
2419 if (bfParser == NULL)
2420 return;
2421 int cursorIdx = bfParser->mCursorIdx;
2422
2423 BfAstNode* target = invocationNode;
2424
2425 if (auto invocationExpr = BfNodeDynCast<BfInvocationExpression>(invocationNode))
2426 {
2427 target = invocationExpr->mTarget;
2428 if (auto memberTarget = BfNodeDynCast<BfMemberReferenceExpression>(target))
2429 {
2430 if (memberTarget->mMemberName != NULL)
2431 target = memberTarget->mMemberName;
2432 }
2433 else if (auto qualifiedTypeRef = BfNodeDynCast<BfQualifiedTypeReference>(target))
2434 {
2435 if (qualifiedTypeRef->mRight != NULL)
2436 target = qualifiedTypeRef->mRight;
2437 }
2438 else if (auto qualifiedNameNode = BfNodeDynCast<BfQualifiedNameNode>(target))
2439 {
2440 if (qualifiedNameNode->mRight != NULL)
2441 target = qualifiedNameNode->mRight;
2442 }
2443
2444 if (auto attributedMember = BfNodeDynCast<BfAttributedIdentifierNode>(target))
2445 if (attributedMember->mIdentifier != NULL)
2446 target = attributedMember->mIdentifier;

Callers 7

TryCaseTupleMatchMethod · 0.80
TryCaseEnumMatchMethod · 0.80
GetCustomAttributesMethod · 0.80
EmitCtorBodyMethod · 0.80
GetLambdaInstanceMethod · 0.80
CreateObjectMethod · 0.80
DoInvocationMethod · 0.80

Calls 7

AssertErrorStateMethod · 0.80
GetSourceDataMethod · 0.80
ToParserMethod · 0.45
GetSrcStartMethod · 0.45
ClearMethod · 0.45
push_backMethod · 0.45
GetSrcEndMethod · 0.45

Tested by

no test coverage detected