From 7da3ddda1a2e37607bd4b33224a813acb970f56d Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Sun, 27 Oct 2024 16:22:17 -0700 Subject: [PATCH] refactor: remove option type from J.New (#1201) * refactor: remove option type from J.New * don't match --- jscomp/core/j.ml | 3 +-- jscomp/core/js_dump.ml | 3 +-- jscomp/core/js_exp_make.ml | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/jscomp/core/j.ml b/jscomp/core/j.ml index 4e43b0e37..12daa7378 100644 --- a/jscomp/core/j.ml +++ b/jscomp/core/j.ml @@ -130,8 +130,7 @@ and expression_desc = All exported declarations have to be OCaml identifiers 2. Javascript dot (need to be preserved/or using quote) *) - | New of { expr : expression; args : expression list option } - (* TODO: option remove *) + | New of { expr : expression; args : expression list } | Var of vident | Fun of { method_ : bool; diff --git a/jscomp/core/js_dump.ml b/jscomp/core/js_dump.ml index df7b915b6..185275513 100644 --- a/jscomp/core/js_dump.ml +++ b/jscomp/core/js_dump.ml @@ -892,8 +892,7 @@ and expression_desc cxt ~(level : int) x : cxt = string cxt L.new_; space cxt; let cxt = expression ~level:16 cxt e in - paren_group cxt 1 (fun _ -> - match el with Some el -> arguments cxt el | None -> cxt))) + paren_group cxt 1 (fun _ -> arguments cxt el))) | Cond { pred = e; then_ = e1; else_ = e2 } -> let action () = let cxt = expression ~level:3 cxt e in diff --git a/jscomp/core/js_exp_make.ml b/jscomp/core/js_exp_make.ml index 3813a1365..fe0736f6d 100644 --- a/jscomp/core/js_exp_make.ml +++ b/jscomp/core/js_exp_make.ml @@ -205,7 +205,7 @@ let typeof ?loc ?comment (e : t) : t = | _ -> make_expression ?loc ?comment (Typeof e) let new_ ?loc ?comment e0 args : t = - make_expression ?loc ?comment (New { expr = e0; args = Some args }) + make_expression ?loc ?comment (New { expr = e0; args }) let unit : t = make_expression Undefined