Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make genhl respect Meta.NoExpr. #11257

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/generators/genhl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3329,15 +3329,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