| 88 | } |
| 89 | |
| 90 | void genCode(CppiaCompiler *compiler, Expressions &inArgs, const JitVal &inDest, ExprType destType) |
| 91 | { |
| 92 | bool ok = args.size() && args.size()==inArgs.size(); |
| 93 | if (!ok) |
| 94 | printf("Bad enum arg count\n"); |
| 95 | |
| 96 | compiler->callNative( (void *)createEnumBase, (void *)this ); |
| 97 | JitTemp result(compiler,jtPointer); |
| 98 | compiler->move(result, sJitReturnReg); |
| 99 | |
| 100 | int offset = sizeof(EnumBase_obj); |
| 101 | for(int i=0;i<args.size();i++) |
| 102 | { |
| 103 | ExprType type = inArgs[i]->getType(); |
| 104 | JitTemp val(compiler,getJitType(type)); |
| 105 | inArgs[i]->genCode(compiler, val, inArgs[i]->getType()); |
| 106 | compiler->move( sJitReturnReg.as(jtPointer), result ); |
| 107 | if (type==etString) |
| 108 | { |
| 109 | compiler->move( sJitReturnReg.star(jtInt,offset + offsetof(cpp::Variant,valStringLen)), val.as(jtInt) ); |
| 110 | compiler->move( sJitReturnReg.star(jtPointer,offset), val.as(jtPointer) + StringOffset::Ptr); |
| 111 | } |
| 112 | else |
| 113 | { |
| 114 | compiler->move( sJitReturnReg.star(type,offset), val ); |
| 115 | } |
| 116 | compiler->move( sJitReturnReg.star(jtInt,offset + offsetof(cpp::Variant,type)), (int)getVariantType(type) ); |
| 117 | |
| 118 | offset += sizeof(cpp::Variant); |
| 119 | } |
| 120 | |
| 121 | if (destType==etObject) |
| 122 | compiler->move(inDest, sJitReturnReg.as(jtPointer)); |
| 123 | } |
| 124 | #endif |
| 125 | |
| 126 | }; |
nothing calls this directly
no test coverage detected