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

Method CheckObjectCreateTypeRef

IDEHelper/Compiler/BfExprEvaluator.cpp:15906–15944  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15904}
15905
15906void BfExprEvaluator::CheckObjectCreateTypeRef(BfType* expectingType, BfAstNode* afterNode)
15907{
15908 auto autoComplete = GetAutoComplete();
15909 if ((autoComplete != NULL) && (afterNode != NULL) && (autoComplete->mIsAutoComplete) &&
15910 (afterNode->IsFromParser(mModule->mCompiler->mResolvePassData->mParsers[0])) &&
15911 (afterNode->GetParser()->mCursorIdx == afterNode->GetSrcEnd() + 1))
15912 {
15913 BfType* expectingType = mExpectingType;
15914 BfTypeInstance* expectingTypeInst = NULL;
15915
15916 if (mExpectingType != NULL)
15917 {
15918 expectingTypeInst = mExpectingType->ToTypeInstance();
15919 }
15920
15921 if ((mExpectingType != NULL) && (((expectingTypeInst == NULL) || (!expectingTypeInst->mTypeDef->mIsDelegate))))
15922 {
15923 // Why were we doing this? It floods the autocomplete with every possible type
15924 //autoComplete->AddTopLevelTypes(NULL);
15925 autoComplete->mInsertStartIdx = afterNode->GetSourceData()->ToParser()->mCursorIdx;
15926 BF_ASSERT(autoComplete->mInsertStartIdx != -1);
15927 auto expectingType = mExpectingType;
15928 while (expectingType->IsArray())
15929 {
15930 auto arrayType = (BfArrayType*)expectingType;
15931 expectingType = arrayType->mGenericTypeInfo->mTypeGenericArguments[0];
15932 }
15933
15934 auto expectingTypeInst = expectingType->ToTypeInstance();
15935 if (expectingTypeInst != NULL)
15936 {
15937 if (!expectingTypeInst->IsAnonymous())
15938 autoComplete->AddTypeInstanceEntry(expectingTypeInst);
15939 }
15940 else
15941 autoComplete->mDefaultSelection = mModule->TypeToString(expectingType);
15942 }
15943 }
15944}
15945
15946void BfExprEvaluator::Visit(BfObjectCreateExpression* objCreateExpr)
15947{

Callers

nothing calls this directly

Calls 10

IsFromParserMethod · 0.80
GetParserMethod · 0.80
GetSourceDataMethod · 0.80
AddTypeInstanceEntryMethod · 0.80
GetSrcEndMethod · 0.45
ToTypeInstanceMethod · 0.45
ToParserMethod · 0.45
IsArrayMethod · 0.45
IsAnonymousMethod · 0.45
TypeToStringMethod · 0.45

Tested by

no test coverage detected