| 15904 | } |
| 15905 | |
| 15906 | void 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 | |
| 15946 | void BfExprEvaluator::Visit(BfObjectCreateExpression* objCreateExpr) |
| 15947 | { |
nothing calls this directly
no test coverage detected