|
@@ -146,8 +146,24 @@ let catch_exceptions ctx ?(final=(fun() -> ())) f p =
|
|
|
let v2 = field v key_pos in
|
|
|
GlobalState.get_ctx_ref := prev;
|
|
|
final();
|
|
|
- match v1,v2 with
|
|
|
- | VString s,VInstance {ikind = IPos p} ->
|
|
|
+ match v1 with
|
|
|
+ | VString s ->
|
|
|
+ let p =
|
|
|
+ match v2 with
|
|
|
+ | VInstance { ikind = IPos p } -> p
|
|
|
+ | VObject o ->
|
|
|
+ (try
|
|
|
+ let fields = object_fields o in
|
|
|
+ let min = match List.assoc key_min fields with VInt32 i -> Int32.to_int i | _ -> raise Not_found
|
|
|
+ and max = match List.assoc key_max fields with VInt32 i -> Int32.to_int i | _ -> raise Not_found
|
|
|
+ and file = match List.assoc key_file fields with VString s -> s.sstring | _ -> raise Not_found
|
|
|
+ in
|
|
|
+ { pmin = min; pmax = max; pfile = file }
|
|
|
+ with Not_found ->
|
|
|
+ null_pos
|
|
|
+ )
|
|
|
+ | _ -> null_pos
|
|
|
+ in
|
|
|
raise (Error.Error (Error.Custom s.sstring,p))
|
|
|
| _ ->
|
|
|
Error.error "Something went wrong" null_pos
|