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

Method IsAutocompleteLineNode

IDEHelper/Compiler/BfAutoComplete.cpp:358–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358bool 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
402BfTypedValue BfAutoComplete::LookupTypeRefOrIdentifier(BfAstNode* node, bool* isStatic, BfEvalExprFlags evalExprFlags, BfType* expectingType)

Callers

nothing calls this directly

Calls 4

GetSourceDataMethod · 0.80
IsTemporaryMethod · 0.45
ToParserMethod · 0.45
GetSrcStartMethod · 0.45

Tested by

no test coverage detected