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

Method runFloat

src/hx/cppia/ArrayBuiltin.cpp:568–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

566 return 0;
567 }
568 Float runFloat(CppiaCtx *ctx) HXCPP_OVERRIDE
569 {
570 if (FUNC==afPop)
571 {
572 Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx);
573 BCR_CHECK;
574 return ValToFloat(thisVal->pop());
575 }
576 if (FUNC==afShift)
577 {
578 Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx);
579 BCR_CHECK;
580 return ValToFloat(thisVal->shift());
581 }
582 if (FUNC==af__get)
583 {
584 Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx);
585 BCR_CHECK;
586 return ValToFloat(thisVal->__get(args[0]->runInt(ctx)));
587 }
588 if (FUNC==af__set)
589 {
590 Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx);
591 BCR_CHECK;
592 int i = args[0]->runInt(ctx);
593 ELEM elem;
594 runValue(elem,ctx,args[1]);
595 BCR_CHECK;
596 thisVal->Item(i) = elem;
597 #ifdef HXCPP_GC_GENERATIONAL
598 if (hx::ContainsPointers<ELEM>())
599 HX_OBJ_WB_GET(thisVal, hx::PointerOf(elem));
600 #endif
601 return ValToFloat(elem);
602 }
603 if (FUNC==af__crement)
604 {
605 Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx);
606 ELEM &elem = thisVal->Item(args[0]->runInt(ctx));
607
608 Float result = ValToFloat(CREMENT::run(elem));
609 #ifdef HXCPP_GC_GENERATIONAL
610 if (hx::ContainsPointers<ELEM>())
611 HX_OBJ_WB_CTX(thisVal,hx::PointerOf(elem),ctx);
612 #endif
613 return result;
614 }
615
616 if (FUNC==afPush)
617 return runInt(ctx);
618 return 0.0;
619 }
620
621
622 ::String runString(CppiaCtx *ctx) HXCPP_OVERRIDE

Callers

nothing calls this directly

Calls 7

ValToFloatFunction · 0.85
PointerOfFunction · 0.85
runFunction · 0.85
__getMethod · 0.80
runObjectMethod · 0.45
popMethod · 0.45
runIntMethod · 0.45

Tested by

no test coverage detected