|
@@ -371,23 +371,14 @@ let rec can_access ctx ?(in_overload=false) c cf stat =
|
|
|
in
|
|
|
loop c.cl_meta || loop f.cf_meta
|
|
|
in
|
|
|
- let cur_paths = ref [] in
|
|
|
- let rec loop c =
|
|
|
- cur_paths := make_path c ctx.curfield :: !cur_paths;
|
|
|
- begin match c.cl_super with
|
|
|
- | Some (csup,_) -> loop csup
|
|
|
- | None -> ()
|
|
|
- end;
|
|
|
- List.iter (fun (c,_) -> loop c) c.cl_implements;
|
|
|
- in
|
|
|
- loop ctx.curclass;
|
|
|
+ let cur_path = make_path ctx.curclass ctx.curfield in
|
|
|
let is_constr = cf.cf_name = "new" in
|
|
|
let rec loop c =
|
|
|
try
|
|
|
has Meta.Access ctx.curclass ctx.curfield (make_path c cf)
|
|
|
|| (
|
|
|
(* if our common ancestor declare/override the field, then we can access it *)
|
|
|
- let allowed f = is_parent c ctx.curclass || (List.exists (has Meta.Allow c f) !cur_paths) in
|
|
|
+ let allowed f = is_parent c ctx.curclass || (has Meta.Allow c f cur_path) in
|
|
|
if is_constr
|
|
|
then (match c.cl_constructor with
|
|
|
| Some cf -> if allowed cf then true else raise Not_found
|