|
@@ -357,11 +357,14 @@ let add_include writer class_path =
|
|
let gen_forward_decl writer class_path =
|
|
let gen_forward_decl writer class_path =
|
|
begin
|
|
begin
|
|
let output = writer#write in
|
|
let output = writer#write in
|
|
- let name = fst (remap_class_path class_path) in
|
|
|
|
- output ("HX_DECLARE_CLASS" ^ (string_of_int (List.length name ) ) ^ "(");
|
|
|
|
- List.iter (fun package_part -> output (package_part ^ ",") ) name;
|
|
|
|
- output ( (snd class_path) ^ ")\n")
|
|
|
|
- end;;
|
|
|
|
|
|
+ match class_path with
|
|
|
|
+ | (["@verbatim"],file) -> writer#write ("#include <" ^ file ^ ">\n");
|
|
|
|
+ | _ ->
|
|
|
|
+ let name = fst (remap_class_path class_path) in
|
|
|
|
+ output ("HX_DECLARE_CLASS" ^ (string_of_int (List.length name ) ) ^ "(");
|
|
|
|
+ List.iter (fun package_part -> output (package_part ^ ",") ) name;
|
|
|
|
+ output ( (snd class_path) ^ ")\n")
|
|
|
|
+end;;
|
|
|
|
|
|
let real_interfaces =
|
|
let real_interfaces =
|
|
List.filter (function (t,pl) ->
|
|
List.filter (function (t,pl) ->
|
|
@@ -628,6 +631,19 @@ let is_extern_class class_def =
|
|
class_def.cl_extern || (has_meta_key class_def.cl_meta Meta.Extern)
|
|
class_def.cl_extern || (has_meta_key class_def.cl_meta Meta.Extern)
|
|
;;
|
|
;;
|
|
|
|
|
|
|
|
+let is_extern_class_instance obj =
|
|
|
|
+ match follow obj.etype with
|
|
|
|
+ | TInst (klass,params) -> klass.cl_extern
|
|
|
|
+ | _ -> false
|
|
|
|
+;;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+let is_struct_access t =
|
|
|
|
+ match follow t with
|
|
|
|
+ | TInst (class_def,_) -> (has_meta_key class_def.cl_meta Meta.StructAccess)
|
|
|
|
+ | _ -> false
|
|
|
|
+;;
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
let rec is_dynamic_accessor name acc field class_def =
|
|
let rec is_dynamic_accessor name acc field class_def =
|
|
@@ -1082,7 +1098,7 @@ and is_dynamic_member_lookup_in_cpp ctx field_object field =
|
|
try ( let mem_type = (Hashtbl.find ctx.ctx_class_member_types full_name) in
|
|
try ( let mem_type = (Hashtbl.find ctx.ctx_class_member_types full_name) in
|
|
ctx.ctx_dbgout ("/* =" ^ mem_type ^ "*/");
|
|
ctx.ctx_dbgout ("/* =" ^ mem_type ^ "*/");
|
|
false )
|
|
false )
|
|
- with Not_found -> true
|
|
|
|
|
|
+ with Not_found -> not (is_extern_class_instance field_object)
|
|
)
|
|
)
|
|
and is_dynamic_member_return_in_cpp ctx field_object field =
|
|
and is_dynamic_member_return_in_cpp ctx field_object field =
|
|
let member = field_name field in
|
|
let member = field_name field in
|
|
@@ -1586,6 +1602,7 @@ and gen_expression ctx retval expression =
|
|
match follow array_type with
|
|
match follow array_type with
|
|
| TInst (klass,[element]) ->
|
|
| TInst (klass,[element]) ->
|
|
( match type_string element with
|
|
( match type_string element with
|
|
|
|
+ | _ when is_struct_access element -> ()
|
|
| x when cant_be_null x -> ()
|
|
| x when cant_be_null x -> ()
|
|
| _ when is_interface_type element -> ()
|
|
| _ when is_interface_type element -> ()
|
|
| "::String" | "Dynamic" -> ()
|
|
| "::String" | "Dynamic" -> ()
|
|
@@ -1638,7 +1655,9 @@ and gen_expression ctx retval expression =
|
|
(* toString is the only internal member that can be set... *)
|
|
(* toString is the only internal member that can be set... *)
|
|
let settingInternal = assigning && member="toString" in
|
|
let settingInternal = assigning && member="toString" in
|
|
let isString = (type_string field_object.etype)="::String" in
|
|
let isString = (type_string field_object.etype)="::String" in
|
|
- if (is_internal_member member && not settingInternal) then begin
|
|
|
|
|
|
+ if (is_struct_access field_object.etype) then
|
|
|
|
+ output ( "." ^ member )
|
|
|
|
+ else if (is_internal_member member && not settingInternal) then begin
|
|
output ( (if isString then "." else "->") ^ member );
|
|
output ( (if isString then "." else "->") ^ member );
|
|
end else if (settingInternal || is_dynamic_member_lookup_in_cpp ctx field_object field) then begin
|
|
end else if (settingInternal || is_dynamic_member_lookup_in_cpp ctx field_object field) then begin
|
|
if assigning then
|
|
if assigning then
|
|
@@ -1895,7 +1914,8 @@ and gen_expression ctx retval expression =
|
|
output "->__get(";
|
|
output "->__get(";
|
|
gen_expression ctx true index;
|
|
gen_expression ctx true index;
|
|
output ")";
|
|
output ")";
|
|
- check_array_element_cast array_expr.etype ".StaticCast" "()";
|
|
|
|
|
|
+ if not (is_pointer array_expr.etype ) then
|
|
|
|
+ check_array_element_cast array_expr.etype ".StaticCast" "()";
|
|
end
|
|
end
|
|
(* Get precidence matching haxe ? *)
|
|
(* Get precidence matching haxe ? *)
|
|
| TBinop (op,expr1,expr2) -> gen_bin_op op expr1 expr2
|
|
| TBinop (op,expr1,expr2) -> gen_bin_op op expr1 expr2
|
|
@@ -3213,7 +3233,12 @@ let generate_class_files common_ctx member_types super_deps constructor_deps cla
|
|
| Var _ when is_abstract_impl -> false
|
|
| Var _ when is_abstract_impl -> false
|
|
| _ -> true) in
|
|
| _ -> true) in
|
|
|
|
|
|
- let reflective field = not (Meta.has Meta.Unreflective field.cf_meta) in
|
|
|
|
|
|
+ let reflective field = not ( (Meta.has Meta.Unreflective field.cf_meta) ||
|
|
|
|
+ (match field.cf_type with
|
|
|
|
+ | TInst (klass,_) -> Meta.has Meta.Unreflective klass.cl_meta
|
|
|
|
+ | _ -> false
|
|
|
|
+ )
|
|
|
|
+ ) in
|
|
let reflect_fields = List.filter reflective (statics_except_meta @ class_def.cl_ordered_fields) in
|
|
let reflect_fields = List.filter reflective (statics_except_meta @ class_def.cl_ordered_fields) in
|
|
let reflect_writable = List.filter is_writable reflect_fields in
|
|
let reflect_writable = List.filter is_writable reflect_fields in
|
|
let reflect_readable = List.filter is_readable reflect_fields in
|
|
let reflect_readable = List.filter is_readable reflect_fields in
|