Skip to content

Commit

Permalink
Merge tag '4.3.4'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/main.yml
  • Loading branch information
RobDangerous committed Mar 5, 2024
2 parents 5953802 + dc1a43d commit 0ff7948
Show file tree
Hide file tree
Showing 76 changed files with 1,117 additions and 191 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ jobs:
- name: Install dependencies
env:
# For compatibility with macOS 10.13
ZLIB_VERSION: 1.3
ZLIB_VERSION: 1.3.1
MBEDTLS_VERSION: 2.28.5
PCRE2_VERSION: 10.42
run: |
Expand All @@ -394,7 +394,7 @@ jobs:
brew install cpanminus
cpanm IPC::System::Simple
cpanm String::ShellQuote
curl -L https://www.zlib.net/zlib-$ZLIB_VERSION.tar.gz | tar xz
curl -L https://github.com/madler/zlib/releases/download/v$ZLIB_VERSION/zlib-$ZLIB_VERSION.tar.gz | tar xz
cd zlib-$ZLIB_VERSION
./configure
make && make install
Expand Down
31 changes: 31 additions & 0 deletions extra/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
2024-03-04 4.3.4

General improvements:

all : allow @:using with Class and Enum (#11553)
display : expose list of metadata/defines (#11399)

Bugfixes:

all : typedef vs. GADT (#11446)
all : don't double-throw exceptions (#11175)
all : fix some abstract inlining failures (#11526)
all : fix JsonPrinter empty parent class (#11560)
all : dce: clean up operator handling (#11427)
all : analyzer: deal with unreachable block in binops (#11402)
all : analyzer: don't recursively check enum values when const propagating (#11429)
all : analyzer: fix check for inlined purity meta
display : fix errors from parser missing in diagnostics (#8687)
display : fix display services with static extension (#11285)
display : fix display services with safe navigation (#11205)
hl : hlopt rework try-catch control flow (#11581)
hl/c : fix reserved keywords (#11408)

Deprecation / future version handling:

all : don't infer string on concat, when using -D haxe-next (#11318)
all : handle optional arguments with bind, when using -D haxe-next (#11533)
macro : build order vs inheritance, when using -D haxe-next (#11582)
macro : deprecate some API from haxe.macro.Compiler (see #11540)
java/jvm : warn about --java ... -D jvm vs --jvm ...

2023-09-17 4.3.3

General improvements:
Expand Down
6 changes: 3 additions & 3 deletions haxe.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
opam-version: "2.0"
name: "haxe"
version: "4.3.3"
version: "4.3.4"
synopsis: "Multi-target universal programming language"
description: """
Haxe is an open source toolkit based on a modern,
Expand All @@ -20,7 +20,7 @@ install: [make "install" "INSTALL_DIR=%{prefix}%"]
remove: [make "uninstall" "INSTALL_DIR=%{prefix}%"]
depends: [
("ocaml" {>= "5.0"} & ("camlp5" {build}))
| ("ocaml" {>= "4.08" & < "5.0"} & ("camlp5" {build & = "8.00"}))
| ("ocaml" {>= "4.08" & < "5.0"} & ("camlp5" {build & = "8.00.03"}))
"ocamlfind" {build}
"dune" {>= "1.11"}
"sedlex" {>= "2.0"}
Expand All @@ -32,5 +32,5 @@ depends: [
"conf-libpcre2-8"
"conf-zlib"
"conf-neko"
"luv"
"luv" {= "0.5.12"}
]
12 changes: 12 additions & 0 deletions src-prebuild/prebuild.ml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,18 @@ let parse_meta_usage = function
| \"TVariable\" -> TVariable
| t -> raise (failwith (\"invalid metadata target \" ^ t))
let print_meta_usage = function
| TClass -> \"TClass\"
| TClassField -> \"TClassField\"
| TAbstract -> \"TAbstract\"
| TAbstractField -> \"TAbstractField\"
| TEnum -> \"TEnum\"
| TTypedef -> \"TTypedef\"
| TAnyField -> \"TAnyField\"
| TExpr -> \"TExpr\"
| TTypeParameter -> \"TTypeParameter\"
| TVariable -> \"TVariable\"
type meta_parameter =
| HasParam of string
| Platforms of platform list
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/args.ml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ let process_args arg_spec =

let parse_args com =
let usage = Printf.sprintf
"Haxe Compiler %s - (C)2005-2023 Haxe Foundation\nUsage: haxe%s <target> [options] [hxml files and dot paths...]\n"
"Haxe Compiler %s - (C)2005-2024 Haxe Foundation\nUsage: haxe%s <target> [options] [hxml files and dot paths...]\n"
s_version_full (if Sys.os_type = "Win32" then ".exe" else "")
in
let actx = {
Expand Down Expand Up @@ -158,7 +158,7 @@ let parse_args com =
let all,max_length = Define.get_user_documentation_list com.user_defines in
let all = List.map (fun (n,doc) -> Printf.sprintf " %-*s: %s" max_length n (limit_string doc (max_length + 3))) all in
List.iter (fun msg -> com.print (msg ^ "\n")) all;
exit 0
raise Abort
)
),"","print help for all user defines");
("Miscellaneous",["--help-metas"],[], Arg.Unit (fun() ->
Expand All @@ -173,7 +173,7 @@ let parse_args com =
let all,max_length = Meta.get_user_documentation_list com.user_metas in
let all = List.map (fun (n,doc) -> Printf.sprintf " %-*s: %s" max_length n (limit_string doc (max_length + 3))) all in
List.iter (fun msg -> com.print (msg ^ "\n")) all;
exit 0
raise Abort
)
),"","print help for all user metadatas");
] in
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/displayOutput.ml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ let print_fields fields =
| ITPackage(path,_) -> "package",snd path,"",None
| ITModule path -> "type",snd path,"",None
| ITMetadata meta ->
let s,(doc,_),_ = Meta.get_info meta in
"metadata","@" ^ s,"",doc_from_string doc
let s,data = Meta.get_info meta in
"metadata","@" ^ s,"",doc_from_string data.m_doc
| ITTimer(name,value) -> "timer",name,"",doc_from_string value
| ITLiteral s ->
let t = match k.ci_type with None -> t_dynamic | Some (t,_) -> t in
Expand Down
5 changes: 3 additions & 2 deletions src/compiler/generate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ let generate ctx tctx ext actx =
| Cs ->
Gencs.generate,"cs"
| Java ->
if Common.defined com Jvm then
if Common.defined com Jvm then begin
com.warning WDeprecated com.warning_options ("--java out.jar -D jvm is deprecated; use --jvm out.jar directly") null_pos;
Genjvm.generate actx.jvm_flag,"java"
else
end else
Genjava.generate,"java"
| Python ->
Genpy.generate,"python"
Expand Down
1 change: 0 additions & 1 deletion src/context/common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ open Warning

type package_rule =
| Forbidden
| Directory of string
| Remap of string

type pos = Globals.pos
Expand Down
29 changes: 24 additions & 5 deletions src/context/display/displayFields.ml
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,31 @@ let collect_static_extensions ctx items e p =
| _ ->
let items = loop items ctx.m.module_using in
let items = loop items ctx.g.global_using in
let items = try
let mt = module_type_of_type e.etype in
loop items (t_infos mt).mt_using
with Exit ->
items
let rec loop_module_using items t = match follow_without_type t with
| TInst(c,_) ->
loop items c.cl_using
| TEnum(en,_) ->
loop items en.e_using
| TType(td,tl) ->
let items = loop items td.t_using in
loop_module_using items (apply_typedef td tl)
| TAbstract(a,_) ->
loop items a.a_using
| TAnon an ->
begin match !(an.a_status) with
| Statics c ->
loop items c.cl_using
| EnumStatics en ->
loop items en.e_using
| AbstractStatics a ->
loop items a.a_using
| _ ->
items
end
| _ ->
items
in
let items = loop_module_using items e.etype in
items

let collect ctx e_ast e dk with_type p =
Expand Down
65 changes: 65 additions & 0 deletions src/context/display/displayJson.ml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,71 @@ let handler =
hctx.display#set_display_file (hctx.jsonrpc#get_bool_param "wasAutoTriggered") true;
hctx.display#enable_display DMSignature
);
"display/metadata", (fun hctx ->
let include_compiler_meta = hctx.jsonrpc#get_bool_param "compiler" in
let include_user_meta = hctx.jsonrpc#get_bool_param "user" in

hctx.com.callbacks#add_after_init_macros (fun () ->
let all = Meta.get_meta_list hctx.com.user_metas in
let all = List.filter (fun (_, (data:Meta.meta_infos)) ->
match data.m_origin with
| Compiler when include_compiler_meta -> true
| UserDefined _ when include_user_meta -> true
| _ -> false
) all in

hctx.send_result (jarray (List.map (fun (t, (data:Meta.meta_infos)) ->
let fields = [
"name", jstring t;
"doc", jstring data.m_doc;
"parameters", jarray (List.map jstring data.m_params);
"platforms", jarray (List.map (fun p -> jstring (platform_name p)) data.m_platforms);
"targets", jarray (List.map (fun u -> jstring (Meta.print_meta_usage u)) data.m_used_on);
"internal", jbool data.m_internal;
"origin", jstring (match data.m_origin with
| Compiler -> "haxe compiler"
| UserDefined None -> "user-defined"
| UserDefined (Some o) -> o
);
"links", jarray (List.map jstring data.m_links)
] in

(jobject fields)
) all))
)
);
"display/defines", (fun hctx ->
let include_compiler_defines = hctx.jsonrpc#get_bool_param "compiler" in
let include_user_defines = hctx.jsonrpc#get_bool_param "user" in

hctx.com.callbacks#add_after_init_macros (fun () ->
let all = Define.get_define_list hctx.com.user_defines in
let all = List.filter (fun (_, (data:Define.define_infos)) ->
match data.d_origin with
| Compiler when include_compiler_defines -> true
| UserDefined _ when include_user_defines -> true
| _ -> false
) all in

hctx.send_result (jarray (List.map (fun (t, (data:Define.define_infos)) ->
let fields = [
"name", jstring t;
"doc", jstring data.d_doc;
"parameters", jarray (List.map jstring data.d_params);
"platforms", jarray (List.map (fun p -> jstring (platform_name p)) data.d_platforms);
"origin", jstring (match data.d_origin with
| Compiler -> "haxe compiler"
| UserDefined None -> "user-defined"
| UserDefined (Some o) -> o
);
"deprecated", jopt jstring data.d_deprecated;
"links", jarray (List.map jstring data.d_links)
] in

(jobject fields)
) all))
)
);
"server/readClassPaths", (fun hctx ->
hctx.com.callbacks#add_after_init_macros (fun () ->
let cc = hctx.display#get_cs#get_context (Define.get_signature hctx.com.defines) in
Expand Down
2 changes: 0 additions & 2 deletions src/context/display/displayPath.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ module TypePathHandler = struct
| x :: l ->
(try
match PMap.find x com.package_rules with
| Directory d -> d :: l
| Remap s -> s :: l
| _ -> p
with
Expand All @@ -47,7 +46,6 @@ module TypePathHandler = struct
match PMap.find f com.package_rules with
| Forbidden -> ()
| Remap f -> packages := f :: !packages
| Directory _ -> raise Not_found
with Not_found ->
packages := f :: !packages
else
Expand Down
1 change: 0 additions & 1 deletion src/context/display/displayToplevel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class explore_class_path_task com checked recursive f_pack f_module dir pack = o
begin try
begin match PMap.find file com.package_rules with
| Forbidden | Remap _ -> ()
| _ -> raise Not_found
end
with Not_found ->
f_pack (List.rev pack,file);
Expand Down
5 changes: 4 additions & 1 deletion src/context/typecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -713,10 +713,13 @@ let get_next_stored_typed_expr_id =
let uid = ref 0 in
(fun() -> incr uid; !uid)

let make_stored_id_expr id p =
(EConst (Int (string_of_int id, None))), p

let store_typed_expr com te p =
let id = get_next_stored_typed_expr_id() in
com.stored_typed_exprs#add id te;
let eid = (EConst (Int (string_of_int id, None))), p in
let eid = make_stored_id_expr id p in
id,((EMeta ((Meta.StoredTypedExpr,[],null_pos), eid)),p)

let push_this ctx e = match e.eexpr with
Expand Down
61 changes: 46 additions & 15 deletions src/core/define.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,59 @@ type define_origin =
| Compiler
| UserDefined of string option

let infos ?user_defines d = match (user_defines,d) with
type define_infos = {
d_doc : string;
d_params : string list;
d_platforms : Globals.platform list;
d_origin : define_origin;
d_links : string list;
d_deprecated : string option;
}

let infos ?user_defines d =
let extract_infos (t, (doc, flags), origin) =
let params = ref [] and pfs = ref [] and links = ref [] and deprecated = ref None in
List.iter (function
| HasParam s -> params := s :: !params
| Platforms fl -> pfs := fl @ !pfs
| Link url -> links := url :: !links
| Deprecated s -> deprecated := Some s
) flags;
(t, {
d_doc = doc;
d_params = !params;
d_platforms = !pfs;
d_origin = origin;
d_links = !links;
d_deprecated = !deprecated;
})
in

extract_infos (match (user_defines,d) with
| (Some(user_defines), Custom(s)) when (Hashtbl.mem user_defines s) ->
let infos = Hashtbl.find user_defines s in
(s, (infos.doc, infos.flags), (UserDefined infos.source))
| (_, Custom(s)) ->
(s, ("", []), Compiler)
| _ ->
let def,infos = DefineList.infos d in
(def, infos, Compiler)
(def, infos, Compiler))

let get_define_key d =
match (infos d) with (s,_,_) -> s
match (infos d) with (s,_) -> s

let get_documentation user_defines d =
let t, (doc,flags), origin = infos ~user_defines:user_defines d in
let params = ref [] and pfs = ref [] in
List.iter (function
| HasParam s -> params := s :: !params
| Platforms fl -> pfs := fl @ !pfs
| Link _ -> ()
| Deprecated _ -> ()
) flags;
let params = (match List.rev !params with
let t, data = infos ~user_defines:user_defines d in
let params = (match List.rev data.d_params with
| [] -> ""
| l -> "<" ^ String.concat ">, <" l ^ "> "
) in
let origin = match origin with
let origin = match data.d_origin with
| UserDefined Some s -> " (from " ^ s ^ ")"
| Compiler | UserDefined None -> ""
in
let pfs = platform_list_help (List.rev !pfs) in
(String.concat "-" (ExtString.String.nsplit t "_")), params ^ doc ^ pfs ^ origin
let pfs = platform_list_help (List.rev data.d_platforms) in
(String.concat "-" (ExtString.String.nsplit t "_")), params ^ data.d_doc ^ pfs ^ origin

let get_documentation_list user_defines =
let m = ref 0 in
Expand All @@ -77,6 +98,16 @@ let get_user_documentation_list user_defines =
let all = List.sort (fun (s1,_) (s2,_) -> String.compare s1 s2) user_defines_list in
all,!m

let get_define_list user_defines =
let rec loop i acc =
let d = Obj.magic i in
if d <> Last then (infos ~user_defines d) :: loop (i + 1) acc
else acc
in

let all = loop 0 (Hashtbl.fold (fun str _ acc -> (infos ~user_defines (Custom str)) :: acc) user_defines []) in
List.sort (fun (s1,_) (s2,_) -> String.compare s1 s2) all

let raw_defined ctx k =
PMap.mem k ctx.values

Expand Down
Loading

0 comments on commit 0ff7948

Please sign in to comment.