Ver código fonte

[cpp] Mark functions that use unreflective types as unreflective too. Follow abstracts when considering unreflective. Closes https://github.com/HaxeFoundation/hxcpp/issues/441

Hugh 9 anos atrás
pai
commit
c0bdc35042
1 arquivos alterados com 11 adições e 5 exclusões
  1. 11 5
      src/generators/gencpp.ml

+ 11 - 5
src/generators/gencpp.ml

@@ -3627,15 +3627,21 @@ let all_virtual_functions clazz =
    List.rev (all_virtual_functions_rev clazz)
 ;;
 
+
+let rec unreflective_type t =
+    match follow t with
+       | TInst (klass,_) ->  Meta.has Meta.Unreflective klass.cl_meta
+       | TFun (args,ret) -> 
+           List.fold_left (fun result (_,_,t) -> result || (unreflective_type t)) (unreflective_type ret) args;
+       | _ -> false
+;;
+
 let reflective class_def field = not (
     (Meta.has Meta.NativeGen class_def.cl_meta) ||
     (Meta.has Meta.Unreflective class_def.cl_meta) ||
     (Meta.has Meta.Unreflective field.cf_meta) ||
-    (match field.cf_type with
-       | TInst (klass,_) ->  Meta.has Meta.Unreflective klass.cl_meta
-       | _ -> false
-    )
-)
+    unreflective_type field.cf_type
+   )
 ;;