Skip to content

Commit

Permalink
[macro] reification: do not apply @:pos to type path
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Jan 16, 2025
1 parent 62eaa64 commit 5b9609b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/syntax/reification.ml
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,17 @@ let reify in_macro =
("name", (efield(ei,"name"),p));
("sub", (efield(ei,"sub"),p));
("params", ea);
("pos", to_pos p);
("posPath", to_pos ptp.pos_path);
("pos", to_pos_obj p);
("posPath", to_pos_obj ptp.pos_path);
] in
to_obj fields p
end else begin
let fields = [
("pack", to_array to_string t.tpackage p);
("name", to_string t.tname p);
("params", to_array to_tparam t.tparams p);
("pos", to_pos p);
("posPath", to_pos ptp.pos_path);
("pos", to_pos_obj p);
("posPath", to_pos_obj ptp.pos_path);
] in
let fields = match t.tsub with None -> fields | Some s -> fields @ ["sub",to_string s p] in
to_obj fields p
Expand Down Expand Up @@ -226,23 +226,23 @@ let reify in_macro =
] in
to_obj fields p
) m p
and to_pos p =
match !cur_pos with
| Some p ->
p
| None ->
and to_pos_obj p =
let file = (EConst (String(p.pfile,SDoubleQuotes)),p) in
let pmin = (EConst (Int ((string_of_int p.pmin), None)),p) in
let pmax = (EConst (Int ((string_of_int p.pmax), None)),p) in
if in_macro then
(EUntyped (ECall ((EConst (Ident "$__mk_pos__"),p),[file;pmin;pmax]),p),p)
else
to_obj [("file",file);("min",pmin);("max",pmax)] p
and to_pos p =
match !cur_pos with
| Some p -> p
| None -> to_pos_obj p
and to_enc_pos p =
match !cur_pos with
| Some p -> p
| None when in_macro -> to_pos p
| None -> (ECall ((efield ((efield ((efield ((EConst (Ident "haxe"),p),"macro"),p),"Context"),p),"makePosition"),p),[to_pos p]),p)
| None when in_macro -> to_pos_obj p
| None -> (ECall ((efield ((efield ((efield ((EConst (Ident "haxe"),p),"macro"),p),"Context"),p),"makePosition"),p),[to_pos_obj p]),p)
and to_expr_array a p = match a with
| [EMeta ((Meta.Dollar "a",[],_),e1),_] -> (match fst e1 with EArrayDecl el -> to_expr_array el p | _ -> e1)
| _ -> to_array to_expr a p
Expand Down

0 comments on commit 5b9609b

Please sign in to comment.