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

Method CheckMemberNames

IDEHelper/Compiler/BfModuleTypeUtils.cpp:862–1022  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

860}
861
862void BfModule::CheckMemberNames(BfTypeInstance* typeInst)
863{
864 struct MemberRef
865 {
866 BfMemberDef* mMemberDef;
867 StringView mName;
868 StringView mKindName;
869 BfTypeInstance* mTypeInst;
870 BfAstNode* mNameNode;
871 BfProtection mProtection;
872 BfTypeDef* mDeclaringType;
873 bool mIsOverride;
874 };
875
876 SizedArray<MemberRef, 64> memberList;
877
878 // Check base types first and then current type
879 auto checkType = typeInst;
880 while (checkType != NULL)
881 {
882 for (auto prop : checkType->mTypeDef->mProperties)
883 {
884 BfPropertyDeclaration* propDecl = (BfPropertyDeclaration*)prop->mFieldDeclaration;
885 if ((propDecl != NULL) && (propDecl->mExplicitInterface != NULL))
886 continue;
887
888 if (!typeInst->IsTypeMemberIncluded(prop->mDeclaringType))
889 continue;
890
891 MemberRef memberRef = { 0 };
892 memberRef.mMemberDef = prop;
893 memberRef.mTypeInst = checkType;
894 memberRef.mProtection = prop->mProtection;
895 memberRef.mName = prop->mName;
896 memberRef.mKindName = "property";
897 auto fieldDecl = prop->GetFieldDeclaration();
898 if (fieldDecl != NULL)
899 memberRef.mNameNode = fieldDecl->mNameNode;
900 memberRef.mDeclaringType = prop->mDeclaringType;
901 auto propertyDeclaration = BfNodeDynCast<BfPropertyDeclaration>(prop->mFieldDeclaration);
902 if (propertyDeclaration != NULL)
903 memberRef.mIsOverride = (propertyDeclaration->mNewSpecifier != NULL) ||
904 ((propertyDeclaration->mVirtualSpecifier != NULL) && (propertyDeclaration->mVirtualSpecifier->GetToken() == BfToken_Override));
905 memberList.push_back(memberRef);
906 }
907
908 for (auto field : checkType->mTypeDef->mFields)
909 {
910 if (!typeInst->IsTypeMemberIncluded(field->mDeclaringType))
911 continue;
912
913 MemberRef memberRef = { 0 };
914 memberRef.mMemberDef = field;
915 memberRef.mTypeInst = checkType;
916 memberRef.mProtection = field->mProtection;
917 memberRef.mName = field->mName;
918 memberRef.mKindName = "field";
919 memberRef.mDeclaringType = field->mDeclaringType;

Callers

nothing calls this directly

Calls 15

StringClass · 0.85
FailFunction · 0.85
GetFieldDeclarationMethod · 0.80
GetTokenMethod · 0.80
GetParamDeclarationMethod · 0.80
TryGetValueMethod · 0.80
IsExtensionMethod · 0.80
GetSourceDataMethod · 0.80
MoreInfoMethod · 0.80
IsTypeMemberIncludedMethod · 0.45
push_backMethod · 0.45
ReserveMethod · 0.45

Tested by

no test coverage detected