|
@@ -3517,6 +3517,11 @@ let cpp_interface_impl_name ctx interface =
|
|
|
;;
|
|
|
|
|
|
|
|
|
+let cpp_class_hash interface =
|
|
|
+ gen_hash 0 (join_class_path interface.cl_path "::" )
|
|
|
+;;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
let has_field_init field =
|
|
|
match field.cf_expr with
|
|
@@ -3560,7 +3565,7 @@ let gen_member_def ctx class_def is_static is_interface field =
|
|
|
let cast = "static_cast< ::" ^ join_class_path_remap class_def.cl_path "::" ^ "_obj *>" in
|
|
|
output (" " ^ returnType ^ " (hx::Object :: *_hx_" ^ remap_name ^ ")(" ^ argList ^ "); \n");
|
|
|
output (" static inline " ^ returnType ^ " " ^ remap_name ^ "( ::Dynamic _hx_" ^ commaArgList ^ ") {\n");
|
|
|
- output (" " ^ returnStr ^ "(_hx_.mPtr->*( " ^ cast ^ "(_hx_.mPtr->_hx_getInterface(" ^ gen_hash 0 (cpp_interface_impl_name ctx class_def) ^ ")))->_hx_" ^ remap_name ^ ")(" ^ cpp_arg_names args ^ ");\n }\n" );
|
|
|
+ output (" " ^ returnStr ^ "(_hx_.mPtr->*( " ^ cast ^ "(_hx_.mPtr->_hx_getInterface(" ^ (cpp_class_hash class_def) ^ ")))->_hx_" ^ remap_name ^ ")(" ^ cpp_arg_names args ^ ");\n }\n" );
|
|
|
end
|
|
|
| _ -> ( )
|
|
|
end else begin
|
|
@@ -4632,7 +4637,9 @@ let generate_class_files baseCtx super_deps constructor_deps class_def inScripta
|
|
|
output_cpp ("void *" ^ class_name ^ "::_hx_getInterface(int inHash) {\n");
|
|
|
output_cpp "\tswitch(inHash) {\n";
|
|
|
List.iter (fun interface_name ->
|
|
|
- output_cpp ("\t\tcase (int)" ^ gen_hash 0 interface_name ^ ": return &" ^ cname ^ "_" ^ interface_name ^ ";\n")
|
|
|
+ try let interface = Hashtbl.find implemented_hash interface_name in
|
|
|
+ output_cpp ("\t\tcase (int)" ^ (cpp_class_hash interface) ^ ": return &" ^ cname ^ "_" ^ interface_name ^ ";\n")
|
|
|
+ with Not_found -> ()
|
|
|
) implemented;
|
|
|
|
|
|
output_cpp "\t}\n";
|
|
@@ -5122,7 +5129,7 @@ let generate_class_files baseCtx super_deps constructor_deps class_def inScripta
|
|
|
output_cpp ("\t__mClass->mMarkFunc = " ^ class_name ^ "_sMarkStatics;\n");
|
|
|
(*output_cpp ("\t__mClass->mStatics = hx::Class_obj::dupFunctions(" ^ sStaticFields ^ ");\n");*)
|
|
|
output_cpp ("\t__mClass->mMembers = hx::Class_obj::dupFunctions(" ^ sMemberFields ^ ");\n");
|
|
|
- output_cpp ("\t__mClass->mCanCast = hx::TIsInterface< " ^ ( gen_hash 0 (cpp_interface_impl_name ctx class_def) ) ^ " >;\n");
|
|
|
+ output_cpp ("\t__mClass->mCanCast = hx::TIsInterface< " ^ (cpp_class_hash class_def) ^ " >;\n");
|
|
|
output_cpp ("#ifdef HXCPP_VISIT_ALLOCS\n\t__mClass->mVisitFunc = " ^ class_name ^ "_sVisitStatics;\n#endif\n");
|
|
|
output_cpp ("\thx::RegisterClass(__mClass->mName, __mClass);\n");
|
|
|
if (scriptable) then
|