|
@@ -985,18 +985,6 @@ let rec is_dynamic_accessor name acc field class_def =
|
|
|
&& (match class_def.cl_super with None -> true | Some (parent,_) -> is_dynamic_accessor name acc field parent )
|
|
|
;;
|
|
|
|
|
|
-
|
|
|
-(* Check to see if we are the first object in the parent tree to implement a dynamic interface *)
|
|
|
-let implement_dynamic_here class_def =
|
|
|
- let implements_dynamic c = match c.cl_dynamic with None -> false | _ -> true in
|
|
|
- let rec super_implements_dynamic c = match c.cl_super with
|
|
|
- | None -> false
|
|
|
- | Some (csup, _) -> if (implements_dynamic csup) then true else
|
|
|
- super_implements_dynamic csup;
|
|
|
- in
|
|
|
- ( (implements_dynamic class_def) && (not (super_implements_dynamic class_def) ) );;
|
|
|
-
|
|
|
-
|
|
|
let gen_hash32 seed str =
|
|
|
let h = ref (Int32.of_int seed) in
|
|
|
let cycle = Int32.of_int 223 in
|
|
@@ -5191,14 +5179,12 @@ let list_iteri func in_list =
|
|
|
;;
|
|
|
|
|
|
let has_new_gc_references ctx class_def =
|
|
|
- match class_def.cl_dynamic with
|
|
|
- | Some _ -> true
|
|
|
- | _ -> (
|
|
|
+ (
|
|
|
let is_gc_reference field =
|
|
|
(should_implement_field field) && (is_data_member field) && not (ctx_cant_be_null ctx field.cf_type)
|
|
|
in
|
|
|
List.exists is_gc_reference class_def.cl_ordered_fields
|
|
|
- )
|
|
|
+ )
|
|
|
;;
|
|
|
|
|
|
|
|
@@ -5254,7 +5240,7 @@ let is_writable class_def field =
|
|
|
let statics_except_meta class_def = (List.filter (fun static -> static.cf_name <> "__meta__" && static.cf_name <> "__rtti") class_def.cl_ordered_statics);;
|
|
|
|
|
|
let has_set_member_field class_def =
|
|
|
- implement_dynamic_here class_def || (
|
|
|
+ (
|
|
|
let reflect_fields = List.filter (reflective class_def) (class_def.cl_ordered_fields) in
|
|
|
let reflect_writable = List.filter (is_writable class_def) reflect_fields in
|
|
|
List.exists variable_field reflect_writable
|
|
@@ -5270,14 +5256,14 @@ let has_set_static_field class_def =
|
|
|
|
|
|
|
|
|
let has_get_fields class_def =
|
|
|
- implement_dynamic_here class_def || (
|
|
|
+ (
|
|
|
let is_data_field field = (match follow field.cf_type with | TFun _ -> false | _ -> true) in
|
|
|
List.exists is_data_field class_def.cl_ordered_fields
|
|
|
)
|
|
|
;;
|
|
|
|
|
|
let has_get_member_field class_def =
|
|
|
- implement_dynamic_here class_def || (
|
|
|
+ (
|
|
|
let reflect_fields = List.filter (reflective class_def) (class_def.cl_ordered_fields) in
|
|
|
List.exists (is_readable class_def) reflect_fields
|
|
|
)
|
|
@@ -5523,7 +5509,6 @@ let generate_class_files baseCtx super_deps constructor_deps class_def inScripta
|
|
|
let classIdTxt = Printf.sprintf "0x%08lx" classId in
|
|
|
|
|
|
(* Config *)
|
|
|
- let implement_dynamic = implement_dynamic_here class_def in
|
|
|
let override_iteration = (not nativeGen) && (has_new_gc_references baseCtx class_def) in
|
|
|
let dynamic_interface_closures = (Common.defined baseCtx.ctx_common Define.DynamicInterfaceClosures) in
|
|
|
|
|
@@ -5892,8 +5877,6 @@ let generate_class_files baseCtx super_deps constructor_deps class_def inScripta
|
|
|
(* MARK function - explicitly mark all child pointers *)
|
|
|
output_cpp ("void " ^ class_name ^ "::__Mark(HX_MARK_PARAMS)\n{\n");
|
|
|
output_cpp ("\tHX_MARK_BEGIN_CLASS(" ^ smart_class_name ^ ");\n");
|
|
|
- if (implement_dynamic) then
|
|
|
- output_cpp "\tHX_MARK_DYNAMIC;\n";
|
|
|
List.iter (dump_field_iterator "HX_MARK_MEMBER_NAME") implemented_instance_fields;
|
|
|
(match super_needs_iteration with
|
|
|
| "" -> ()
|
|
@@ -5903,8 +5886,6 @@ let generate_class_files baseCtx super_deps constructor_deps class_def inScripta
|
|
|
|
|
|
(* Visit function - explicitly visit all child pointers *)
|
|
|
output_cpp ("void " ^ class_name ^ "::__Visit(HX_VISIT_PARAMS)\n{\n");
|
|
|
- if (implement_dynamic) then
|
|
|
- output_cpp "\tHX_VISIT_DYNAMIC;\n";
|
|
|
List.iter (dump_field_iterator "HX_VISIT_MEMBER_NAME") implemented_instance_fields;
|
|
|
(match super_needs_iteration with
|
|
|
| "" -> ()
|
|
@@ -5966,8 +5947,6 @@ let generate_class_files baseCtx super_deps constructor_deps class_def inScripta
|
|
|
) ) )
|
|
|
in
|
|
|
dump_quick_field_test (get_field_dat reflect_member_readable);
|
|
|
- if (implement_dynamic) then
|
|
|
- output_cpp "\tHX_CHECK_DYNAMIC_GET_FIELD(inName);\n";
|
|
|
output_cpp ("\treturn super::__Field(inName,inCallProp);\n}\n\n");
|
|
|
|
|
|
end;
|
|
@@ -6022,12 +6001,7 @@ let generate_class_files baseCtx super_deps constructor_deps class_def inScripta
|
|
|
) in
|
|
|
|
|
|
dump_quick_field_test (set_field_dat reflect_write_member_variables);
|
|
|
- if (implement_dynamic) then begin
|
|
|
- output_cpp ("\ttry { return super::__SetField(inName,inValue,inCallProp); }\n");
|
|
|
- output_cpp ("\tcatch(Dynamic e) { HX_DYNAMIC_SET_FIELD(inName,inValue); }\n");
|
|
|
- output_cpp "\treturn inValue;\n}\n\n";
|
|
|
- end else
|
|
|
- output_cpp ("\treturn super::__SetField(inName,inValue,inCallProp);\n}\n\n");
|
|
|
+ output_cpp ("\treturn super::__SetField(inName,inValue,inCallProp);\n}\n\n");
|
|
|
end;
|
|
|
|
|
|
if (has_set_static_field class_def) then begin
|
|
@@ -6064,8 +6038,6 @@ let generate_class_files baseCtx super_deps constructor_deps class_def inScripta
|
|
|
|
|
|
output_cpp ("void " ^ class_name ^ "::__GetFields(Array< ::String> &outFields)\n{\n");
|
|
|
List.iter append_field (List.filter is_data_field class_def.cl_ordered_fields);
|
|
|
- if (implement_dynamic) then
|
|
|
- output_cpp "\tHX_APPEND_DYNAMIC_FIELDS(outFields);\n";
|
|
|
output_cpp "\tsuper::__GetFields(outFields);\n";
|
|
|
output_cpp "};\n\n";
|
|
|
end;
|
|
@@ -6259,8 +6231,7 @@ let generate_class_files baseCtx super_deps constructor_deps class_def inScripta
|
|
|
output_cpp (" HX_DEFINE_SCRIPTABLE_INTERFACE\n")
|
|
|
else begin
|
|
|
output_cpp (" HX_DEFINE_SCRIPTABLE(HX_ARR_LIST" ^ (string_of_int (List.length constructor_var_list) ) ^ ")\n");
|
|
|
- if (not implement_dynamic) then
|
|
|
- output_cpp "\tHX_DEFINE_SCRIPTABLE_DYNAMIC;\n";
|
|
|
+ output_cpp "\tHX_DEFINE_SCRIPTABLE_DYNAMIC;\n";
|
|
|
end;
|
|
|
end;
|
|
|
|
|
@@ -6540,8 +6511,6 @@ let generate_class_files baseCtx super_deps constructor_deps class_def inScripta
|
|
|
if (has_get_fields class_def) then
|
|
|
output_h ("\t\tvoid __GetFields(Array< ::String> &outFields);\n");
|
|
|
|
|
|
- if (implement_dynamic) then
|
|
|
- output_h ("\t\tHX_DECLARE_IMPLEMENT_DYNAMIC;\n");
|
|
|
output_h ("\t\tstatic void __register();\n");
|
|
|
if (override_iteration) then begin
|
|
|
output_h ("\t\tvoid __Mark(HX_MARK_PARAMS);\n");
|
|
@@ -8047,7 +8016,6 @@ let generate_script_class common_ctx script class_def =
|
|
|
script#write ((string_of_int ( (List.length ordered_fields) +
|
|
|
(List.length ordered_statics) +
|
|
|
(match class_def.cl_constructor with Some _ -> 1 | _ -> 0 ) +
|
|
|
- (if (implement_dynamic_here class_def) then 1 else 0) +
|
|
|
(match class_def.cl_init with Some _ -> 1 | _ -> 0 ) ) )
|
|
|
^ "\n");
|
|
|
|
|
@@ -8088,8 +8056,6 @@ let generate_script_class common_ctx script class_def =
|
|
|
|
|
|
List.iter (generate_field false) ordered_fields;
|
|
|
List.iter (generate_field true) ordered_statics;
|
|
|
- if (implement_dynamic_here class_def) then
|
|
|
- script#implDynamic;
|
|
|
script#write "\n";
|
|
|
;;
|
|
|
|