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

Method WantsNode

IDEHelper/Compiler/BfDefBuilder.cpp:156–177  ·  view source on GitHub ↗

We need to be aware of the startNode because the reducer adds specifiers like 'static' and 'public' AFTER the method has already been handled, so we need to ignore that space while determining if we're "inside" this method or not during autocompletion

Source from the content-addressed store, hash-verified

154// already been handled, so we need to ignore that space while determining if we're "inside" this method or not during
155// autocompletion
156bool BfDefBuilder::WantsNode(BfAstNode* wholeNode, BfAstNode* startNode, int addLen)
157{
158 if ((mResolvePassData == NULL) || (!mResolvePassData->mHasCursorIdx))
159 return true;
160
161 auto parser = wholeNode->GetParser();
162 if (parser->mCursorIdx == -1)
163 return true;
164
165 // We need to get all nodes when we get fixits because the cursor could be either before or after fields with
166 // warnings, but still on the correct line
167 //if (mResolvePassData->mResolveType == BfResolveType_GetFixits)
168 //return true;
169
170 addLen++;
171 if ((parser->mCursorIdx >= wholeNode->GetSrcStart()) && (parser->mCursorIdx < wholeNode->GetSrcEnd() + addLen))
172 {
173 if ((startNode == NULL) || (parser->mCursorIdx >= startNode->GetSrcStart()))
174 return true;
175 }
176 return false;
177}
178
179static int sGenericParamIdx = 0;
180

Callers

nothing calls this directly

Calls 3

GetParserMethod · 0.80
GetSrcStartMethod · 0.45
GetSrcEndMethod · 0.45

Tested by

no test coverage detected