| 862 | } |
| 863 | |
| 864 | void 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 | } |
no test coverage detected