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

Method link

src/hx/cppia/Cppia.cpp:1226–1275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1224 const char *getName() HXCPP_OVERRIDE { return "CastExpr"; }
1225
1226 CppiaExpr *link(CppiaModule &inModule) HXCPP_OVERRIDE
1227 {
1228 value = value->link(inModule);
1229
1230 if (op==castNOP)
1231 {
1232 delete this;
1233 return value;
1234 }
1235
1236 if (op==castInstance)
1237 {
1238 typeData = inModule.types[typeId];
1239 if (typeData->isFloat)
1240 op=castFloat;
1241 else if (typeData->name==HX_CSTRING("Int"))
1242 op=castInt;
1243 else if (typeData->name==HX_CSTRING("Bool"))
1244 op=castBool;
1245 else if (typeData->name==HX_CSTRING("String"))
1246 op=castString;
1247 else
1248 return this;
1249 }
1250
1251 if (op==castDynamic || op==castInt || op==castBool || op==castFloat || op==castString )
1252 {
1253 return this;
1254 //CppiaExpr *replace = value;
1255 //delete this;
1256 //return replace;
1257 }
1258 if (op==castDataArray)
1259 {
1260 TypeData *t = inModule.types[typeId];
1261 arrayType = t->arrayType;
1262 if (arrayType==arrNotArray)
1263 {
1264 CPPIALOG("Cast to %d, %s\n", typeId, t->name.out_str());
1265 throw "Data cast to non-array";
1266 }
1267 }
1268 else if (op==castDynArray)
1269 {
1270 arrayType = arrAny;
1271 }
1272 else
1273 arrayType = arrObject;
1274 return this;
1275 }
1276
1277 #ifdef CPPIA_JIT
1278

Callers

nothing calls this directly

Calls 1

linkMethod · 0.45

Tested by

no test coverage detected