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

Method AddOverrides

IDEHelper/Compiler/BfAutoComplete.cpp:2782–2854  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2780}
2781
2782void BfAutoComplete::AddOverrides(const StringImpl& filter, bool forceAll)
2783{
2784 if (!mIsAutoComplete)
2785 return;
2786
2787 auto activeTypeDef = mModule->GetActiveTypeDef();
2788
2789 BfShow checkShow = BfShow_Hide;
2790
2791 BfTypeInstance* curType = mModule->mCurTypeInstance;
2792 while (curType != NULL)
2793 {
2794 for (auto methodDef : curType->mTypeDef->mMethods)
2795 {
2796 if (methodDef->mShow >= checkShow)
2797 continue;
2798
2799 bool allowInternalOverride = false;
2800 if (curType == mModule->mCurTypeInstance)
2801 {
2802 // The "normal" case, and only case for types without extensions
2803 if ((methodDef->mDeclaringType == activeTypeDef) && (!forceAll))
2804 continue;
2805
2806 if ((methodDef->mDeclaringType->IsExtension()) && (methodDef->mDeclaringType->mProject == activeTypeDef->mProject))
2807 continue;
2808
2809 if (!curType->IsTypeMemberAccessible(methodDef->mDeclaringType, activeTypeDef))
2810 continue;
2811
2812 if (methodDef->mIsExtern)
2813 allowInternalOverride = true;
2814 }
2815
2816 auto& methodGroup = curType->mMethodInstanceGroups[methodDef->mIdx];
2817 if (methodGroup.mDefault == NULL)
2818 {
2819 continue;
2820 }
2821 auto methodInst = methodGroup.mDefault;
2822
2823 if (allowInternalOverride)
2824 {
2825 //
2826 }
2827 else if ((!methodDef->mIsVirtual) || (methodDef->mIsOverride))
2828 continue;
2829
2830 if ((methodDef->mMethodType != BfMethodType_Normal) &&
2831 (methodDef->mMethodType != BfMethodType_PropertyGetter) &&
2832 (methodDef->mMethodType != BfMethodType_PropertySetter))
2833 continue;
2834
2835 if ((methodInst->mVirtualTableIdx >= 0) && (methodInst->mVirtualTableIdx < mModule->mCurTypeInstance->mVirtualMethodTable.size()) && (!forceAll))
2836 {
2837 auto& vEntry = mModule->mCurTypeInstance->mVirtualMethodTable[methodInst->mVirtualTableIdx];
2838 if (vEntry.mImplementingMethod.mTypeInstance == mModule->mCurTypeInstance)
2839 continue;

Callers 1

VisitMethod · 0.80

Calls 7

AutoCompleteEntryClass · 0.85
GetActiveTypeDefMethod · 0.80
IsExtensionMethod · 0.80
sizeMethod · 0.45
IsEmptyMethod · 0.45
IsStructMethod · 0.45

Tested by

no test coverage detected