Skip to content

Commit

Permalink
Make genhl respect Meta.NoExpr. (#11257)
Browse files Browse the repository at this point in the history
Closes #11196
  • Loading branch information
Apprentice-Alchemist authored and kLabz committed Oct 23, 2023
1 parent 87ada5e commit e4a4071
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/generators/genhl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3330,15 +3330,20 @@ let generate_static ctx c f =
let gen_content() =
op ctx (OThrow (make_string ctx ("Requires compiling with -D hl-ver=" ^ ver ^ ".0 or higher") null_pos));
in
ignore(make_fun ctx ~gen_content (s_type_path c.cl_path,f.cf_name) (alloc_fid ctx c f) (match f.cf_expr with Some { eexpr = TFunction f } -> f | _ -> abort "Missing function body" f.cf_pos) None None)
(match f.cf_expr with
| Some { eexpr = TFunction fn } -> ignore(make_fun ctx ~gen_content (s_type_path c.cl_path,f.cf_name) (alloc_fid ctx c f) fn None None)
| _ -> if not (Meta.has Meta.NoExpr f.cf_meta) then abort "Missing function body" f.cf_pos)

else
add_native "std" f.cf_name
| (Meta.HlNative,[] ,_ ) :: _ ->
add_native "std" f.cf_name
| (Meta.HlNative,_ ,p) :: _ ->
abort "Invalid @:hlNative decl" p
| [] ->
ignore(make_fun ctx (s_type_path c.cl_path,f.cf_name) (alloc_fid ctx c f) (match f.cf_expr with Some { eexpr = TFunction f } -> f | _ -> abort "Missing function body" f.cf_pos) None None)
(match f.cf_expr with
| Some { eexpr = TFunction fn } -> ignore(make_fun ctx (s_type_path c.cl_path,f.cf_name) (alloc_fid ctx c f) fn None None)
| _ -> if not (Meta.has Meta.NoExpr f.cf_meta) then abort "Missing function body" f.cf_pos)
| _ :: l ->
loop l
in
Expand Down
3 changes: 3 additions & 0 deletions tests/misc/hl/projects/Issue11196/Issue11196.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function main() {
var a:hl.I64 = 5;
}
3 changes: 3 additions & 0 deletions tests/misc/hl/projects/Issue11196/compile.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-m Issue11196
-hl out.hl
-dce no

0 comments on commit e4a4071

Please sign in to comment.