|
@@ -333,6 +333,7 @@ let get_real_path meta path =
|
|
|
|
|
|
let generate_type com t =
|
|
let generate_type com t =
|
|
let base_path = "hxclasses" in
|
|
let base_path = "hxclasses" in
|
|
|
|
+ match t with TClassDecl { cl_kind = KAbstractImpl _ } -> () | _ ->
|
|
let pack, name =
|
|
let pack, name =
|
|
let info = t_infos t in
|
|
let info = t_infos t in
|
|
get_real_path info.mt_meta info.mt_path
|
|
get_real_path info.mt_meta info.mt_path
|
|
@@ -422,7 +423,7 @@ let generate_type com t =
|
|
let print_meta ml =
|
|
let print_meta ml =
|
|
List.iter (fun (m,pl,_) ->
|
|
List.iter (fun (m,pl,_) ->
|
|
match m with
|
|
match m with
|
|
- | Meta.DefParam | Meta.CoreApi | Meta.Used | Meta.MaybeUsed | Meta.FlatEnum | Meta.Value | Meta.DirectlyUsed -> ()
|
|
|
|
|
|
+ | Meta.DefParam | Meta.CoreApi | Meta.Used | Meta.MaybeUsed | Meta.FlatEnum | Meta.Value | Meta.DirectlyUsed | Meta.Enum | Meta.Impl -> ()
|
|
| _ ->
|
|
| _ ->
|
|
match pl with
|
|
match pl with
|
|
| [] -> p "@%s " (Meta.to_string m)
|
|
| [] -> p "@%s " (Meta.to_string m)
|
|
@@ -546,7 +547,35 @@ let generate_type com t =
|
|
p "\n";
|
|
p "\n";
|
|
| TAbstractDecl a ->
|
|
| TAbstractDecl a ->
|
|
print_meta a.a_meta;
|
|
print_meta a.a_meta;
|
|
- p "abstract %s {}" (stype (TAbstract (a,List.map snd a.a_params)));
|
|
|
|
|
|
+ p "extern ";
|
|
|
|
+ let is_enum = Meta.has Meta.Enum a.a_meta in
|
|
|
|
+ if is_enum then p "enum ";
|
|
|
|
+ p "abstract %s" (stype (TAbstract (a,List.map snd a.a_params)));
|
|
|
|
+ if not (Meta.has Meta.CoreType a.a_meta) then p "(%s)" (stype a.a_this);
|
|
|
|
+ p " {\n";
|
|
|
|
+ Option.may (fun c ->
|
|
|
|
+ let fields = c.cl_ordered_statics in
|
|
|
|
+ let fields =
|
|
|
|
+ if is_enum then
|
|
|
|
+ let sort l =
|
|
|
|
+ let a = Array.of_list l in
|
|
|
|
+ Array.sort (fun a b -> compare a.cf_name b.cf_name) a;
|
|
|
|
+ Array.to_list a
|
|
|
|
+ in
|
|
|
|
+ sort fields
|
|
|
|
+ else
|
|
|
|
+ fields
|
|
|
|
+ in
|
|
|
|
+
|
|
|
|
+ List.iter (fun f ->
|
|
|
|
+ let static = not (Meta.has Meta.Impl f.cf_meta) in
|
|
|
|
+ if not static && is_enum && Meta.has Meta.Enum f.cf_meta then begin
|
|
|
|
+ p "\tvar %s;\n" f.cf_name;
|
|
|
|
+ end else
|
|
|
|
+ print_field static f
|
|
|
|
+ ) fields
|
|
|
|
+ ) a.a_impl;
|
|
|
|
+ p "}\n";
|
|
);
|
|
);
|
|
IO.close_out ch
|
|
IO.close_out ch
|
|
|
|
|