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

Method link

src/hx/cppia/Cppia.cpp:6498–6549  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6496
6497 const char *getName() HXCPP_OVERRIDE { return "VarRef"; }
6498 CppiaExpr *link(CppiaModule &inModule) HXCPP_OVERRIDE
6499 {
6500 var = inModule.layout->findVar(varId);
6501 if (!var)
6502 {
6503 // link to cppia static...
6504
6505 CPPIALOG("Could not link var %d %s.\n", varId, inModule.strings[ getStackVarNameId(varId) ].out_str() );
6506 inModule.layout->dump(inModule.strings,"");
6507 inModule.where(this);
6508 throw "Unknown variable";
6509 }
6510
6511 type = var->expressionType;
6512 stackPos = var->stackPos;
6513 store = var->storeType;
6514
6515 CppiaExpr *replace = 0;
6516 switch(store)
6517 {
6518 case fsBool:
6519 replace = new MemReference<bool,locStack>(this,var->stackPos);
6520 break;
6521 case fsByte:
6522 case fsInt:
6523 replace = new MemReference<int,locStack>(this,var->stackPos);
6524 break;
6525 case fsFloat:
6526 #ifdef HXCPP_ALIGN_FLOAT
6527 replace = new MemStackFloatReference(this,var->stackPos);
6528 #else
6529 replace = new MemReference<Float,locStack>(this,var->stackPos);
6530 #endif
6531 break;
6532 case fsString:
6533 replace = new MemReference<String,locStack>(this,var->stackPos);
6534 break;
6535 case fsObject:
6536 replace = new MemReference<hx::Object *,locStack>(this,var->stackPos);
6537 break;
6538 default: ;
6539 }
6540 if (replace)
6541 {
6542 replace->link(inModule);
6543 delete this;
6544 return replace;
6545 }
6546
6547 CPPIALOG("Unknown var ref!\n");
6548 return this;
6549 }
6550};
6551
6552

Callers

nothing calls this directly

Calls 5

getStackVarNameIdFunction · 0.85
whereMethod · 0.80
findVarMethod · 0.45
dumpMethod · 0.45
linkMethod · 0.45

Tested by

no test coverage detected