| 2387 | } |
| 2388 | |
| 2389 | void 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; |
no test coverage detected