MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / linkTypes

Method linkTypes

src/hx/cppia/CppiaClasses.cpp:864–1214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

862}
863
864void CppiaClassInfo::linkTypes()
865{
866 if (isLinked)
867 return;
868 isLinked = true;
869
870 type = cppia.types[typeId];
871 mClass->mName = type->name;
872 superType = superId ? cppia.types[ superId ] : 0;
873 CppiaClassInfo *cppiaSuper = superType ? superType->cppiaClass : 0;
874 // Link super first
875 if (superType && superType->cppiaClass)
876 superType->cppiaClass->linkTypes();
877
878 // implemented interfaces before main class
879 for(int i=0;i<implements.size();i++)
880 if (cppia.types[ implements[i] ]->cppiaClass)
881 cppia.types[ implements[i] ]->cppiaClass->linkTypes();
882
883
884 // Add super interfaces ...
885 TypeData *extraInterfaces = cppia.types[ superId ];
886 while(extraInterfaces)
887 {
888 if (extraInterfaces->cppiaClass)
889 {
890 CppiaClassInfo &parent = *extraInterfaces->cppiaClass;
891 std::vector<int> &impl = parent.implements;
892 for(int i=0;i<impl.size();i++)
893 {
894 bool found = false;
895 for(int j=0;j<implements.size() && !found; j++)
896 found = implements[j] == impl[i];
897 if (!found)
898 implements.push_back(impl[i]);
899 }
900 extraInterfaces = cppia.types[ parent.superId ];
901 }
902 else
903 {
904 HaxeNativeInterface *native = HaxeNativeInterface::findInterface( extraInterfaces->name.utf8_str() );
905 if (native)
906 {
907 String hashName = extraInterfaces->name.split(HX_CSTRING(".")).mPtr->join(HX_CSTRING("::"));
908 interfaceScriptTables[hashName.hash()] = native->scriptTable;
909 ScriptNamedFunction *functions = native->functions;
910 for(ScriptNamedFunction *f = functions; f && f->name; f++)
911 {
912 nativeInterfaceFunctions.push_back(f);
913 int slot = cppia.getInterfaceSlot(f->name);
914 if (slot<0)
915 printf("Interface slot '%s' not found\n",f->name);
916 if (slot>interfaceSlotSize)
917 interfaceSlotSize = slot;
918 }
919 }
920 break;
921 }

Callers 1

linkMethod · 0.80

Calls 14

linkCppiaClassFunction · 0.85
createEnumClosureFunction · 0.85
utf8_strMethod · 0.80
splitMethod · 0.80
getInterfaceSlotMethod · 0.80
swapMethod · 0.80
c_strMethod · 0.80
identStrMethod · 0.80
linkVarTypesMethod · 0.80
hasPointerMethod · 0.80
addVtableEntriesMethod · 0.80
setVTableSlotMethod · 0.80

Tested by

no test coverage detected