| 10464 | } |
| 10465 | |
| 10466 | BF_EXPORT bool BF_CALLTYPE BfCompiler_VerifyTypeName(BfCompiler* bfCompiler, char* name, int cursorPos) |
| 10467 | { |
| 10468 | bfCompiler->mSystem->AssertWeHaveLock(); |
| 10469 | |
| 10470 | String typeName = name; |
| 10471 | |
| 10472 | auto system = bfCompiler->mSystem; |
| 10473 | AutoCrit autoCrit(system->mSystemLock); |
| 10474 | |
| 10475 | String& autoCompleteResultString = *gTLStrReturn.Get(); |
| 10476 | autoCompleteResultString.Clear(); |
| 10477 | |
| 10478 | BfPassInstance passInstance(bfCompiler->mSystem); |
| 10479 | |
| 10480 | BfParser parser(bfCompiler->mSystem); |
| 10481 | parser.SetSource(typeName.c_str(), (int)typeName.length()); |
| 10482 | parser.Parse(&passInstance); |
| 10483 | parser.mCursorIdx = cursorPos; |
| 10484 | parser.mCursorCheckIdx = cursorPos; |
| 10485 | |
| 10486 | BfReducer reducer; |
| 10487 | reducer.mAlloc = parser.mAlloc; |
| 10488 | reducer.mPassInstance = &passInstance; |
| 10489 | reducer.mAllowTypeWildcard = true; |
| 10490 | |
| 10491 | if (parser.mRootNode->mChildArr.mSize == 0) |
| 10492 | return false; |
| 10493 | |
| 10494 | bool attribWasClosed = false; |
| 10495 | bool isAttributeRef = false; |
| 10496 | auto firstNode = parser.mRootNode->mChildArr[0]; |
| 10497 | auto endIdx = parser.mRootNode->mSrcEnd; |
| 10498 | reducer.mVisitorPos = BfReducer::BfVisitorPos(parser.mRootNode); |
| 10499 | if (auto tokenNode = BfNodeDynCast<BfTokenNode>(firstNode)) |
| 10500 | { |
| 10501 | if (tokenNode->mToken == BfToken_LBracket) |
| 10502 | { |
| 10503 | if (auto lastToken = BfNodeDynCast<BfTokenNode>(parser.mRootNode->mChildArr.back())) |
| 10504 | { |
| 10505 | if (lastToken->mToken == BfToken_RBracket) |
| 10506 | { |
| 10507 | attribWasClosed = true; |
| 10508 | endIdx = lastToken->mSrcStart; |
| 10509 | } |
| 10510 | } |
| 10511 | |
| 10512 | isAttributeRef = true; |
| 10513 | if (parser.mRootNode->mChildArr.mSize < 2) |
| 10514 | return false; |
| 10515 | firstNode = parser.mRootNode->mChildArr[1]; |
| 10516 | reducer.mVisitorPos.MoveNext(); |
| 10517 | } |
| 10518 | } |
| 10519 | |
| 10520 | reducer.mVisitorPos.MoveNext(); |
| 10521 | auto typeRef = reducer.CreateTypeRef(firstNode); |
| 10522 | if (typeRef == NULL) |
| 10523 | return false; |
nothing calls this directly
no test coverage detected