瀏覽代碼

[cpp] Include headers for classes that have instance functions called. Closes #5026

Hugh 9 年之前
父節點
當前提交
5f25fffe5e
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      src/generators/gencpp.ml

+ 8 - 0
src/generators/gencpp.ml

@@ -3755,6 +3755,14 @@ let find_referenced_types_flags ctx obj super_deps constructor_deps header_only
             (* Must visit args too, Type.iter will visit the expressions ... *)
             (* Must visit args too, Type.iter will visit the expressions ... *)
             | TFunction func_def ->
             | TFunction func_def ->
                List.iter (fun (v,_) -> visit_type v.v_type) func_def.tf_args;
                List.iter (fun (v,_) -> visit_type v.v_type) func_def.tf_args;
+
+            | TField( obj, field ) ->
+               (match field with
+               | FInstance (clazz,params,_)
+               | FClosure (Some (clazz,params),_) ->
+                   visit_type (TInst (clazz,params))
+               | _ -> ()
+               )
             | TConst TSuper ->
             | TConst TSuper ->
                (match follow expression.etype with
                (match follow expression.etype with
                | TInst (klass,params) ->
                | TInst (klass,params) ->