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

Method genCode

src/hx/cppia/Cppia.cpp:2707–2882  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2705
2706
2707 void genCode(CppiaCompiler *compiler, const JitVal &inDest,ExprType destType) HXCPP_OVERRIDE
2708 {
2709 if (crement==coNone && assign==aoNone)
2710 {
2711 CPPIALOG("FieldAccess without set\n");
2712 return;
2713 }
2714
2715
2716 JitTemp objTemp(compiler, jtPointer);
2717 JitVal objSrc;
2718
2719 if (object)
2720 {
2721 object->genCode(compiler, objTemp, etObject);
2722 objSrc = objTemp;
2723 }
2724 else if (staticClass.mPtr)
2725 {
2726 objSrc = JitVal( (void *)staticClass.mPtr );
2727 }
2728 else
2729 {
2730 objSrc = sJitThis;
2731 }
2732
2733
2734 bool ret = destType==etInt || destType==etString || destType==etObject || destType==etFloat;
2735 if (crement!=coNone)
2736 {
2737 if (!ret)
2738 {
2739 if (crement==coPostInc || crement==coPreInc)
2740 compiler->callNative((void *)incByNameV, objSrc, (void *)&name );
2741 else
2742 compiler->callNative((void *)decByNameV, objSrc, (void *)&name );
2743 compiler->checkException();
2744 }
2745 else
2746 {
2747 JitTemp gotVal(compiler, etString, sizeof(cpp::Variant));
2748 void *func = 0;
2749 switch(crement)
2750 {
2751 case coPostInc: func = (void *)postIncByName; break;
2752 case coPreInc: func = (void *)preIncByName; break;
2753 case coPostDec: func = (void *)postDecByName; break;
2754 case coPreDec: func = (void *)preDecByName; break;
2755 default:
2756 CPPIALOG("Error in crement?\n");
2757 CppiaTrap();
2758 }
2759 compiler->callNative(func, objSrc, (void *)&name, gotVal );
2760 compiler->checkException();
2761 compiler->genVariantValueTemp0(0, inDest, destType);
2762 }
2763
2764 return;

Callers

nothing calls this directly

Calls 10

JitValClass · 0.85
CppiaTrapFunction · 0.85
callNativeMethod · 0.80
checkExceptionMethod · 0.80
genVariantValueTemp0Method · 0.80
asMethod · 0.80
convertReturnRegMethod · 0.80
convertMethod · 0.80
genCodeMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected