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

Method runInt

src/hx/cppia/ArrayBuiltin.cpp:462–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

460
461
462 int runInt(CppiaCtx *ctx) HXCPP_OVERRIDE
463 {
464 if (FUNC==afPush)
465 {
466 Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx);
467 BCR_CHECK;
468 ELEM elem;
469 runValue(elem,ctx,args[0]);
470 BCR_CHECK;
471 int result = thisVal->push(elem);
472 return result;
473 }
474 if (FUNC==afPop)
475 {
476 Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx);
477 BCR_CHECK;
478 return ValToInt(thisVal->pop());
479 }
480 if (FUNC==afShift)
481 {
482 Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx);
483 BCR_CHECK;
484 return ValToInt(thisVal->shift());
485 }
486 if (FUNC==afContains)
487 {
488 Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx);
489 BCR_CHECK;
490 ELEM elem;
491 runValue(elem,ctx,args[0]);
492 BCR_CHECK;
493 return thisVal->contains(elem);
494 }
495 if (FUNC==afRemove)
496 {
497 Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx);
498 BCR_CHECK;
499 ELEM elem;
500 runValue(elem,ctx,args[0]);
501 BCR_CHECK;
502 return thisVal->remove(elem);
503 }
504 if (FUNC==afIndexOf)
505 {
506 Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx);
507 BCR_CHECK;
508 ELEM elem;
509 runValue(elem,ctx,args[0]);
510 BCR_CHECK;
511 hx::Object *start = args[1]->runObject(ctx);
512 BCR_CHECK;
513 return thisVal->indexOf(elem,start);
514 }
515 if (FUNC==afLastIndexOf)
516 {
517 Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx);
518 BCR_CHECK;
519 ELEM elem;

Callers

nothing calls this directly

Calls 11

ValToIntFunction · 0.85
PointerOfFunction · 0.85
runFunction · 0.85
removeMethod · 0.80
indexOfMethod · 0.80
lastIndexOfMethod · 0.80
__getMethod · 0.80
runObjectMethod · 0.45
pushMethod · 0.45
popMethod · 0.45
runIntMethod · 0.45

Tested by

no test coverage detected