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

Method pushArgs

src/hx/cppia/CppiaFunction.cpp:381–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379
380
381void ScriptCallable::pushArgs(CppiaCtx *ctx, hx::Object *inThis, Expressions &inArgs)
382{
383 BCR_VCHECK;
384 int inCount = inArgs.size();
385 bool badCount = argCount<inCount;
386
387 for(int i=inCount;i<argCount && !badCount;i++)
388 if (!hasDefault[i])
389 badCount = true;
390
391 if (badCount)
392 {
393 printf("Arg count mismatch %d!=%d ?\n", argCount, (int)inArgs.size());
394 printf(" %s at %s:%d %s\n", getName(), filename, line, functionName);
395 CPPIA_CHECK(0);
396 throw Dynamic(HX_CSTRING("Arg count error"));
397 //return;
398 }
399
400
401 ctx->push( inThis );
402
403 for(int a=0;a<argCount;a++)
404 {
405 CppiaStackVar &var = args[a];
406 if (a>=inCount)
407 {
408 pushDefault(ctx,a);
409 }
410 else
411 {
412 switch(var.argType)
413 {
414 case etInt:
415 ctx->pushInt(inArgs[a]->runInt(ctx));
416 break;
417 case etFloat:
418 ctx->pushFloat(inArgs[a]->runFloat(ctx));
419 break;
420 case etString:
421 ctx->pushString(inArgs[a]->runString(ctx));
422 break;
423 default:
424 ctx->pushObject(inArgs[a]->runObject(ctx));
425 }
426 BCR_VCHECK;
427 }
428 }
429}
430
431
432

Callers 4

runFunExprFunction · 0.80
runStringMethod · 0.80
runObjectMethod · 0.80
runVoidMethod · 0.80

Calls 11

pushIntMethod · 0.80
pushFloatMethod · 0.80
pushStringMethod · 0.80
pushObjectMethod · 0.80
DynamicClass · 0.50
sizeMethod · 0.45
pushMethod · 0.45
runIntMethod · 0.45
runFloatMethod · 0.45
runStringMethod · 0.45
runObjectMethod · 0.45

Tested by

no test coverage detected