|
@@ -630,7 +630,6 @@ let rec get_class_modifiers meta cl_type cl_access cl_modifiers =
|
|
| (Meta.Internal,[],_) :: meta -> get_class_modifiers meta cl_type "internal" cl_modifiers
|
|
| (Meta.Internal,[],_) :: meta -> get_class_modifiers meta cl_type "internal" cl_modifiers
|
|
(* no abstract for now | (":abstract",[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("abstract" :: cl_modifiers)
|
|
(* no abstract for now | (":abstract",[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("abstract" :: cl_modifiers)
|
|
| (":static",[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("static" :: cl_modifiers) TODO: support those types *)
|
|
| (":static",[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("static" :: cl_modifiers) TODO: support those types *)
|
|
- | (Meta.Final,[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("sealed" :: cl_modifiers)
|
|
|
|
| (Meta.Unsafe,[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("unsafe" :: cl_modifiers)
|
|
| (Meta.Unsafe,[],_) :: meta -> get_class_modifiers meta cl_type cl_access ("unsafe" :: cl_modifiers)
|
|
| _ :: meta -> get_class_modifiers meta cl_type cl_access cl_modifiers
|
|
| _ :: meta -> get_class_modifiers meta cl_type cl_access cl_modifiers
|
|
|
|
|
|
@@ -1847,7 +1846,7 @@ let generate con =
|
|
acc
|
|
acc
|
|
|
|
|
|
(* non-sealed class *)
|
|
(* non-sealed class *)
|
|
- | TInst ({ cl_interface = false; cl_meta = meta},_) when not (Meta.has Meta.Final meta) ->
|
|
|
|
|
|
+ | TInst ({ cl_interface = false; cl_final = false},_) ->
|
|
base_class_constraints := (t_s t) :: !base_class_constraints;
|
|
base_class_constraints := (t_s t) :: !base_class_constraints;
|
|
acc;
|
|
acc;
|
|
|
|
|
|
@@ -1907,10 +1906,10 @@ let generate con =
|
|
let fn_is_final = function
|
|
let fn_is_final = function
|
|
| None -> true
|
|
| None -> true
|
|
| Some ({ cf_kind = Method mkind } as m) ->
|
|
| Some ({ cf_kind = Method mkind } as m) ->
|
|
- (match mkind with | MethInline -> true | _ -> false) || Meta.has Meta.Final m.cf_meta
|
|
|
|
|
|
+ (match mkind with | MethInline -> true | _ -> false) || m.cf_final
|
|
| _ -> assert false
|
|
| _ -> assert false
|
|
in
|
|
in
|
|
- let is_virtual = not (is_interface || is_final || Meta.has Meta.Final prop.cf_meta || fn_is_final get || fn_is_final set) in
|
|
|
|
|
|
+ let is_virtual = not (is_interface || is_final || prop.cf_final || fn_is_final get || fn_is_final set) in
|
|
|
|
|
|
let fn_is_override = function
|
|
let fn_is_override = function
|
|
| Some cf -> List.memq cf cl.cl_overrides
|
|
| Some cf -> List.memq cf cl.cl_overrides
|
|
@@ -2045,7 +2044,7 @@ let generate con =
|
|
end (* TODO see how (get,set) variable handle when they are interfaces *)
|
|
end (* TODO see how (get,set) variable handle when they are interfaces *)
|
|
| Method _ when not (Type.is_physical_field cf) || (match cl.cl_kind, cf.cf_expr with | KAbstractImpl _, None -> true | _ -> false) ->
|
|
| Method _ when not (Type.is_physical_field cf) || (match cl.cl_kind, cf.cf_expr with | KAbstractImpl _, None -> true | _ -> false) ->
|
|
List.iter (fun cf -> if cl.cl_interface || cf.cf_expr <> None then
|
|
List.iter (fun cf -> if cl.cl_interface || cf.cf_expr <> None then
|
|
- gen_class_field w ~is_overload:true is_static cl (Meta.has Meta.Final cf.cf_meta) cf
|
|
|
|
|
|
+ gen_class_field w ~is_overload:true is_static cl cf.cf_final cf
|
|
) cf.cf_overloads
|
|
) cf.cf_overloads
|
|
| Var _ | Method MethDynamic -> ()
|
|
| Var _ | Method MethDynamic -> ()
|
|
| Method _ when is_new && Meta.has Meta.Struct cl.cl_meta && fst (get_fun cf.cf_type) = [] ->
|
|
| Method _ when is_new && Meta.has Meta.Struct cl.cl_meta && fst (get_fun cf.cf_type) = [] ->
|
|
@@ -2065,15 +2064,15 @@ let generate con =
|
|
| _ -> ());
|
|
| _ -> ());
|
|
List.iter (fun cf ->
|
|
List.iter (fun cf ->
|
|
if cl.cl_interface || cf.cf_expr <> None then
|
|
if cl.cl_interface || cf.cf_expr <> None then
|
|
- gen_class_field w ~is_overload:true is_static cl (Meta.has Meta.Final cf.cf_meta) cf
|
|
|
|
|
|
+ gen_class_field w ~is_overload:true is_static cl cf.cf_final cf
|
|
) cf.cf_overloads;
|
|
) cf.cf_overloads;
|
|
| Method mkind ->
|
|
| Method mkind ->
|
|
List.iter (fun cf ->
|
|
List.iter (fun cf ->
|
|
if cl.cl_interface || cf.cf_expr <> None then
|
|
if cl.cl_interface || cf.cf_expr <> None then
|
|
- gen_class_field w ~is_overload:true is_static cl (Meta.has Meta.Final cf.cf_meta) cf
|
|
|
|
|
|
+ gen_class_field w ~is_overload:true is_static cl cf.cf_final cf
|
|
) cf.cf_overloads;
|
|
) cf.cf_overloads;
|
|
let is_virtual = not is_final && match mkind with | MethInline -> false | _ when not is_new -> true | _ -> false in
|
|
let is_virtual = not is_final && match mkind with | MethInline -> false | _ when not is_new -> true | _ -> false in
|
|
- let is_virtual = if not is_virtual || Meta.has Meta.Final cf.cf_meta then false else is_virtual in
|
|
|
|
|
|
+ let is_virtual = if not is_virtual || cf.cf_final then false else is_virtual in
|
|
let is_override = List.memq cf cl.cl_overrides in
|
|
let is_override = List.memq cf cl.cl_overrides in
|
|
let is_override = is_override || match cf.cf_name, follow cf.cf_type with
|
|
let is_override = is_override || match cf.cf_name, follow cf.cf_type with
|
|
| "Equals", TFun([_,_,targ], tret) ->
|
|
| "Equals", TFun([_,_,targ], tret) ->
|
|
@@ -2085,7 +2084,7 @@ let generate con =
|
|
in
|
|
in
|
|
let is_override = if Meta.has (Meta.Custom "?prop_impl") cf.cf_meta then false else is_override in
|
|
let is_override = if Meta.has (Meta.Custom "?prop_impl") cf.cf_meta then false else is_override in
|
|
|
|
|
|
- let is_virtual = is_virtual && not (Meta.has Meta.Final cl.cl_meta) && not (is_interface) in
|
|
|
|
|
|
+ let is_virtual = is_virtual && not cl.cl_final && not (is_interface) in
|
|
let visibility = if is_interface then "" else "public" in
|
|
let visibility = if is_interface then "" else "public" in
|
|
|
|
|
|
let visibility, modifiers = get_fun_modifiers cf.cf_meta visibility [] in
|
|
let visibility, modifiers = get_fun_modifiers cf.cf_meta visibility [] in
|
|
@@ -2410,7 +2409,8 @@ let generate con =
|
|
in
|
|
in
|
|
|
|
|
|
let clt, access, modifiers = get_class_modifiers cl.cl_meta (if cl.cl_interface then "interface" else "class") "public" [] in
|
|
let clt, access, modifiers = get_class_modifiers cl.cl_meta (if cl.cl_interface then "interface" else "class") "public" [] in
|
|
- let is_final = clt = "struct" || Meta.has Meta.Final cl.cl_meta in
|
|
|
|
|
|
+ let modifiers = if cl.cl_final then "sealed" :: modifiers else modifiers in
|
|
|
|
+ let is_final = clt = "struct" || cl.cl_final in
|
|
|
|
|
|
let modifiers = [access] @ modifiers in
|
|
let modifiers = [access] @ modifiers in
|
|
print w "%s %s %s" (String.concat " " modifiers) clt (change_clname (snd cl.cl_path));
|
|
print w "%s %s %s" (String.concat " " modifiers) clt (change_clname (snd cl.cl_path));
|