Skip to content

Commit e4ad372

Browse files
committed
Better syntactic Assignments.is_noop
1 parent d52f710 commit e4ad372

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arrayjit/lib/assignments.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ and t =
4444
| Fetch of { array : Tn.t; fetch_op : fetch_op; dims : int array Lazy.t }
4545
[@@deriving sexp_of]
4646

47-
let is_noop = function Noop -> true | _ -> false
48-
4947
let get_name_exn asgns =
5048
let punct_or_sp = Str.regexp "[-@*/:.;, ]" in
5149
let punct_and_sp = Str.regexp {|[-@*/:.;,]\( |$\)|} in
@@ -250,6 +248,9 @@ let flatten c =
250248
in
251249
loop c
252250

251+
let is_noop c =
252+
List.for_all ~f:(function Noop | Block_comment (_, Noop) -> true | _ -> false) @@ flatten c
253+
253254
let get_ident_within_code ?no_dots c =
254255
let ident_style = Tn.get_style ~arg_name:"cd_ident_style" ?no_dots () in
255256
let nograd_idents = Hashtbl.create (module String) in

0 commit comments

Comments
 (0)