| 2919 | const char *getName() HXCPP_OVERRIDE { return "GetFieldByName"; } |
| 2920 | |
| 2921 | CppiaExpr *link(CppiaModule &inModule) HXCPP_OVERRIDE |
| 2922 | { |
| 2923 | if (object) |
| 2924 | object = object->link(inModule); |
| 2925 | TypeData *type = inModule.types[classId]; |
| 2926 | if (!isStatic && type->cppiaClass) |
| 2927 | { |
| 2928 | vtableSlot = type->cppiaClass->findFunctionSlot(nameId); |
| 2929 | isInterface = type->cppiaClass->isInterface; |
| 2930 | name = inModule.strings[nameId]; |
| 2931 | } |
| 2932 | else if (isStatic) |
| 2933 | { |
| 2934 | if (type->cppiaClass) |
| 2935 | { |
| 2936 | CppiaVar *var = type->cppiaClass->findVar(true,nameId); |
| 2937 | if (var) |
| 2938 | { |
| 2939 | CppiaExpr *replace = var->createAccess(this); |
| 2940 | if (!replace) |
| 2941 | throw "Bad replace"; |
| 2942 | replace->link(inModule); |
| 2943 | delete this; |
| 2944 | return replace; |
| 2945 | } |
| 2946 | |
| 2947 | CppiaExpr *func = type->cppiaClass->findFunction(true,nameId); |
| 2948 | if (func) |
| 2949 | { |
| 2950 | CppiaExprWithValue *replace = new CppiaExprWithValue(this); |
| 2951 | replace->link(inModule); |
| 2952 | replace->value = createMemberClosure(0, ((ScriptCallable *)func)); |
| 2953 | delete this; |
| 2954 | return replace; |
| 2955 | } |
| 2956 | } |
| 2957 | |
| 2958 | staticClass = type->haxeClass; |
| 2959 | if (!staticClass.mPtr) |
| 2960 | { |
| 2961 | inModule.where(this); |
| 2962 | if (type->cppiaClass) |
| 2963 | type->cppiaClass->dump(); |
| 2964 | CPPIALOG("Could not link static %s::%s (%d)\n", type->name.c_str(), inModule.strings[nameId].out_str(), nameId ); |
| 2965 | throw "Bad link"; |
| 2966 | } |
| 2967 | name = inModule.strings[nameId]; |
| 2968 | const StaticInfo *info = staticClass->GetStaticStorage(name); |
| 2969 | |
| 2970 | // Do not use a MemReference for static access to objects. |
| 2971 | // If the object in question is a hx::Callable_obj, its pointer will be downcasted to a hx::Object* and then updated to a non callable_obj pointer. |
| 2972 | // This leads to memory exceptions later when then trying to invoke that callable. |
| 2973 | if (info && info->type!=hx::fsUnknown && info->type != fsObject) |
| 2974 | { |
| 2975 | CppiaExpr* replace = createStaticAccess(this, info->type, info->address); |
| 2976 | replace->link(inModule); |
| 2977 | delete this; |
| 2978 | return replace; |
nothing calls this directly
no test coverage detected