| 356 | } |
| 357 | |
| 358 | bool BfAutoComplete::IsAutocompleteLineNode(BfAstNode* node) |
| 359 | { |
| 360 | if (node == NULL) |
| 361 | return false; |
| 362 | |
| 363 | // if (!node->IsFromParser(mCompiler->mResolvePassData->mParser)) |
| 364 | // return false; |
| 365 | |
| 366 | if (node->IsTemporary()) |
| 367 | return false; |
| 368 | auto bfParser = node->GetSourceData()->ToParser(); |
| 369 | if (bfParser == NULL) |
| 370 | return false; |
| 371 | if ((bfParser->mParserFlags & ParserFlag_Autocomplete) == 0) |
| 372 | return false; |
| 373 | |
| 374 | int startAdd = 0; |
| 375 | |
| 376 | if (mCursorLineStart == -1) |
| 377 | { |
| 378 | auto nodeSource = node->GetSourceData(); |
| 379 | |
| 380 | mCursorLineStart = bfParser->mCursorIdx; |
| 381 | while (mCursorLineStart > 0) |
| 382 | { |
| 383 | if (nodeSource->mSrc[mCursorLineStart - 1] == '\n') |
| 384 | break; |
| 385 | mCursorLineStart--; |
| 386 | } |
| 387 | |
| 388 | mCursorLineEnd = bfParser->mCursorIdx; |
| 389 | while (mCursorLineEnd < nodeSource->mSrcLength) |
| 390 | { |
| 391 | if (nodeSource->mSrc[mCursorLineEnd] == '\n') |
| 392 | break; |
| 393 | mCursorLineEnd++; |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | int srcStart = node->GetSrcStart(); |
| 398 | return (srcStart >= mCursorLineStart) && (srcStart <= mCursorLineEnd); |
| 399 | } |
| 400 | |
| 401 | // The parser thought this was a type reference but it may not be |
| 402 | BfTypedValue BfAutoComplete::LookupTypeRefOrIdentifier(BfAstNode* node, bool* isStatic, BfEvalExprFlags evalExprFlags, BfType* expectingType) |
nothing calls this directly
no test coverage detected