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

Method link

src/hx/cppia/Cppia.cpp:8113–8250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8111
8112
8113void TypeData::link(CppiaModule &inModule)
8114{
8115 if (linked)
8116 return;
8117
8118 linked = true;
8119
8120 TypeData *cppiaSuperType = 0;
8121 if (cppiaClass && cppiaClass->superId)
8122 {
8123 cppiaSuperType = inModule.types[cppiaClass->superId];
8124 cppiaSuperType->link(inModule);
8125 }
8126
8127 if (name.length>0)
8128 {
8129 haxeClass = hx::Class_obj::Resolve(name);
8130 int scriptId = getScriptId(haxeClass);
8131 if (scriptId>0 && scriptId!=inModule.scriptId)
8132 {
8133 DBGLOG("Reference to old script %s - ignoring\n", haxeClass.mPtr->mName.out_str());
8134 haxeClass.mPtr = 0;
8135 }
8136 DBGLOG("Link %s, haxe=%s\n", name.out_str(), haxeClass.mPtr ? haxeClass.mPtr->mName.out_str() : "?" );
8137 if (!haxeClass.mPtr && !cppiaClass && name==HX_CSTRING("int"))
8138 {
8139 name = HX_CSTRING("Int");
8140 haxeClass = hx::Class_obj::Resolve(name);
8141 }
8142 if (!haxeClass.mPtr && !cppiaClass && name==HX_CSTRING("bool"))
8143 {
8144 name = HX_CSTRING("Bool");
8145 haxeClass = hx::Class_obj::Resolve(name);
8146 }
8147 if (!haxeClass.mPtr && !cppiaClass && (name==HX_CSTRING("float") || name==HX_CSTRING("double")))
8148 {
8149 name = HX_CSTRING("Float");
8150 haxeClass = hx::Class_obj::Resolve(name);
8151 }
8152
8153 DBGLOG(" link type '%s' %s ", name.out_str(), haxeClass.mPtr ? "native" : "script" );
8154 interfaceBase = HaxeNativeInterface::findInterface(name.utf8_str());
8155 isInterface = interfaceBase || (cppiaClass && cppiaClass->isInterface);
8156
8157 if (!haxeClass.mPtr && name.substr(0,6)==HX_CSTRING("Array.") || name==HX_CSTRING("Array") )
8158 {
8159 haxeClass = hx::Class_obj::Resolve(HX_CSTRING("Array"));
8160 if (name.length==5)
8161 arrayType = arrAny;
8162 else
8163 {
8164 String t = name.substr(6,null());
8165
8166 if (t==HX_CSTRING("int"))
8167 arrayType = arrInt;
8168 else if (t==HX_CSTRING("bool"))
8169 arrayType = arrBool;
8170 else if (t==HX_CSTRING("Float"))

Callers 15

LinkExpressionsFunction · 0.45
linkMethod · 0.45
linkMethod · 0.45
linkMethod · 0.45
linkMethod · 0.45
linkMethod · 0.45
linkMethod · 0.45
linkMethod · 0.45
linkMethod · 0.45
linkMethod · 0.45
linkMethod · 0.45
linkMethod · 0.45

Calls 4

getScriptIdFunction · 0.85
utf8_strMethod · 0.80
substrMethod · 0.80
nullClass · 0.50

Tested by

no test coverage detected