Skip to content

Commit

Permalink
Less hacky way to retrieve haxe.macro.Field type
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Apr 9, 2024
1 parent b0f1e5a commit aede1af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/typing/macroContext.ml
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,8 @@ let type_macro ctx mode cpath f (el:Ast.expr list) p =
| None -> die "" __LOC__
| Some (_,_,fields) -> fields)
else
(* Hacky way to retrieve haxe.macro.Field type... *)
let t = match follow mret with | TInst(_, [ftype]) -> ftype | _ -> assert false in
let ct = make_ptp_th (mk_type_path ~sub:"Field" (["haxe";"macro"], "Expr")) null_pos in
let t = Typeload.load_complex_type mctx false LoadNormal ct in
List.map (fun f -> safe_decode ctx.com f "Field" t p (fun () -> Interp.decode_field f)) (Interp.decode_array v)
in
MSuccess (EVars [mk_evar ~t:(CTAnonymous fields,p) ("fields",null_pos)],p)
Expand Down

0 comments on commit aede1af

Please sign in to comment.