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

Method pushArgDynamic

src/hx/cppia/CppiaFunction.cpp:791–826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

789 }
790
791 void pushArgDynamic(CppiaCtx *ctx, int a, Dynamic inValue)
792 {
793 // Developer has used dynamic to call a closure with wrong # parameters
794 if (a>=function->args.size())
795 return;
796
797 if (!inValue.mPtr)
798 {
799 function->pushDefault(ctx,a);
800 return;
801 }
802
803 switch(function->args[a].argType)
804 {
805 case etInt:
806 ctx->pushInt(inValue->__ToInt());
807 return;
808 case etFloat:
809 ctx->pushFloat(inValue->__ToDouble());
810 break;
811 case etString:
812 ctx->pushString(inValue.mPtr ? inValue->toString() : String());
813 break;
814 default:
815 {
816 hx::Object *value = inValue.mPtr;
817 if (value)
818 {
819 ArrayType want = function->args[a].type->arrayType;
820 if (want!=arrNotArray)
821 value = DynamicToArrayType(value, want);
822 }
823 ctx->pushObject(value);
824 }
825 }
826 }
827
828
829

Callers

nothing calls this directly

Calls 11

DynamicToArrayTypeFunction · 0.85
pushDefaultMethod · 0.80
pushIntMethod · 0.80
pushFloatMethod · 0.80
pushStringMethod · 0.80
pushObjectMethod · 0.80
StringClass · 0.50
sizeMethod · 0.45
__ToIntMethod · 0.45
__ToDoubleMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected