Skip to content

remove unused code #4138

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

Merged
merged 3 commits into from
Feb 2, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jscomp/core/lam.mli
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ val switch : t -> lambda_switch -> t
(** constant folding*)
val stringswitch : t -> (string * t) list -> t option -> t

val true_ : t
val false_ : t
(* val true_ : t *)
(* val false_ : t *)
val unit : t

(** convert [l || r] to [if l then true else r]*)
Expand Down
20 changes: 10 additions & 10 deletions jscomp/js_parser/file_key.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ let to_string = function
x
| Builtins -> "(global)"

let to_path = function
(* let to_path = function
| LibFile x
| SourceFile x
| JsonFile x
| ResourceFile x ->
Ok x
| Builtins -> Error "File key refers to a builtin"
| Builtins -> Error "File key refers to a builtin" *)

let compare =
(* builtins, then libs, then source and json files at the same priority since
Expand All @@ -56,30 +56,30 @@ let compare_opt a b =
| (None, None) -> 0
| (Some a, Some b) -> compare a b

let is_lib_file = function
(* let is_lib_file = function
| LibFile _ -> true
| Builtins -> true
| SourceFile _ -> false
| JsonFile _ -> false
| ResourceFile _ -> false
| ResourceFile _ -> false *)

let map f = function
(* let map f = function
| LibFile filename -> LibFile (f filename)
| SourceFile filename -> SourceFile (f filename)
| JsonFile filename -> JsonFile (f filename)
| ResourceFile filename -> ResourceFile (f filename)
| Builtins -> Builtins
| Builtins -> Builtins *)

let exists f = function
(* let exists f = function
| LibFile filename
| SourceFile filename
| JsonFile filename
| ResourceFile filename ->
f filename
| Builtins -> false
| Builtins -> false *)

let check_suffix filename suffix = exists (fun fn -> Filename.check_suffix fn suffix) filename
(* let check_suffix filename suffix = exists (fun fn -> Filename.check_suffix fn suffix) filename

let chop_suffix filename suffix = map (fun fn -> Filename.chop_suffix fn suffix) filename

let with_suffix filename suffix = map (fun fn -> fn ^ suffix) filename
let with_suffix filename suffix = map (fun fn -> fn ^ suffix) filename *)
18 changes: 9 additions & 9 deletions jscomp/js_parser/flow_ast_utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type 'loc ident = 'loc * string

type 'loc source = 'loc * string

let rec fold_bindings_of_pattern =
(* let rec fold_bindings_of_pattern =
Pattern.(
let property f acc =
Object.(
Expand All @@ -35,9 +35,9 @@ let rec fold_bindings_of_pattern =
| Identifier { Identifier.name; _ } -> f acc name
| Object { Object.properties; _ } -> List.fold_left (property f) acc properties
| Array { Array.elements; _ } -> List.fold_left (element f) acc elements
| Expression _ -> failwith "expression pattern")
| Expression _ -> failwith "expression pattern") *)

let fold_bindings_of_variable_declarations f acc declarations =
(* let fold_bindings_of_variable_declarations f acc declarations =
Flow_ast.Statement.VariableDeclaration.(
List.fold_left
(fun acc -> function
Expand Down Expand Up @@ -70,11 +70,11 @@ let loc_of_expression = fst

let loc_of_pattern = fst

let loc_of_ident = fst
let loc_of_ident = fst *)

let name_of_ident (_, { Identifier.name; comments = _ }) = name

let source_of_ident (loc, { Identifier.name; comments = _ }) = (loc, name)
(* let source_of_ident (loc, { Identifier.name; comments = _ }) = (loc, name) *)

let ident_of_source (loc, name) = (loc, { Identifier.name; comments = None })

Expand All @@ -85,7 +85,7 @@ let mk_comments_opt ?(leading = []) ?(trailing = []) () =
| ([], []) -> None
| (_, _) -> Some (mk_comments ~leading ~trailing ())

let string_of_assignment_operator op =
(* let string_of_assignment_operator op =
Flow_ast.Expression.Assignment.(
match op with
| PlusAssign -> "+="
Expand Down Expand Up @@ -125,7 +125,7 @@ let string_of_binary_operator op =
| Xor -> "^"
| BitAnd -> "&"
| In -> "in"
| Instanceof -> "instanceof")
| Instanceof -> "instanceof") *)

module ExpressionSort = struct
type t =
Expand Down Expand Up @@ -161,7 +161,7 @@ module ExpressionSort = struct
| Update
| Yield

let to_string = function
(* let to_string = function
| Array -> "array"
| ArrowFunction -> "arrow function"
| Assignment -> "assignment expression"
Expand Down Expand Up @@ -192,5 +192,5 @@ module ExpressionSort = struct
| TypeCast -> "type cast"
| Unary -> "unary expression"
| Update -> "update expression"
| Yield -> "yield expression"
| Yield -> "yield expression" *)
end
16 changes: 8 additions & 8 deletions jscomp/js_parser/flow_ast_utils.mli
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type 'loc ident = 'loc * string

type 'loc source = 'loc * string

val fold_bindings_of_pattern :
(* val fold_bindings_of_pattern :
('a -> ('loc, 'loc) Flow_ast.Identifier.t -> 'a) -> 'a -> ('loc, 'loc) Flow_ast.Pattern.t' -> 'a

val fold_bindings_of_variable_declarations :
Expand All @@ -32,19 +32,19 @@ val loc_of_statement : ('a, 'a) Flow_ast.Statement.t -> 'a

val loc_of_pattern : ('a, 'a) Flow_ast.Pattern.t -> 'a

val loc_of_ident : ('a, 'a) Flow_ast.Identifier.t -> 'a
val loc_of_ident : ('a, 'a) Flow_ast.Identifier.t -> 'a *)

val name_of_ident : ('loc, 'a) Flow_ast.Identifier.t -> string

val source_of_ident : ('a, 'a) Flow_ast.Identifier.t -> 'a source
(* val source_of_ident : ('a, 'a) Flow_ast.Identifier.t -> 'a source *)

val ident_of_source : 'a source -> ('a, 'a) Flow_ast.Identifier.t

val mk_comments :
(* val mk_comments :
?leading:'loc Flow_ast.Comment.t list ->
?trailing:'loc Flow_ast.Comment.t list ->
'a ->
('loc, 'a) Flow_ast.Syntax.t
('loc, 'a) Flow_ast.Syntax.t *)

val mk_comments_opt :
?leading:'loc Flow_ast.Comment.t list ->
Expand Down Expand Up @@ -86,9 +86,9 @@ module ExpressionSort : sig
| Update
| Yield

val to_string : t -> string
(* val to_string : t -> string *)
end

val string_of_assignment_operator : Flow_ast.Expression.Assignment.operator -> string
(* val string_of_assignment_operator : Flow_ast.Expression.Assignment.operator -> string *)

val string_of_binary_operator : Flow_ast.Expression.Binary.operator -> string
(* val string_of_binary_operator : Flow_ast.Expression.Binary.operator -> string *)
10 changes: 5 additions & 5 deletions jscomp/js_parser/lex_env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ let get_and_clear_state env =
in
(env, state)

let lexbuf env = env.lex_lb
(* let lexbuf env = env.lex_lb *)

let source env = env.lex_source

let state env = env.lex_state
(* let state env = env.lex_state *)

let line env = env.lex_bol.line

Expand All @@ -71,9 +71,9 @@ let in_comment_syntax is_in env =
env

(* TODO *)
let debug_string_of_lexbuf _lb = ""
(* let debug_string_of_lexbuf _lb = "" *)

let debug_string_of_lex_env (env : t) =
(* let debug_string_of_lex_env (env : t) =
let source =
match source env with
| None -> "None"
Expand All @@ -85,4 +85,4 @@ let debug_string_of_lex_env (env : t) =
(debug_string_of_lexbuf env.lex_lb)
(is_in_comment_syntax env)
(is_comment_syntax_enabled env)
(List.length (state env).lex_errors_acc)
(List.length (state env).lex_errors_acc) *)
4 changes: 2 additions & 2 deletions jscomp/js_parser/lex_result.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ let comments result = result.lex_comments

let errors result = result.lex_errors

let debug_string_of_lex_result lex_result =
(* let debug_string_of_lex_result lex_result =
Printf.sprintf
"{\n lex_token = %s\n lex_value = %S\n lex_errors = (length = %d)\n lex_comments = (length = %d)\n}"
(Token.token_to_string lex_result.lex_token)
(Token.value_of_token lex_result.lex_token)
(List.length lex_result.lex_errors)
(List.length lex_result.lex_comments)
(List.length lex_result.lex_comments) *)
28 changes: 14 additions & 14 deletions jscomp/js_parser/loc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let btwn loc1 loc2 = { source = loc1.source; start = loc1.start; _end = loc2._en
(* Returns the position immediately before the start of the given loc. If the
given loc is at the beginning of a line, return the position of the first
char on the same line. *)
let char_before loc =
(* let char_before loc =
let start =
let { line; column } = loc.start in
let column =
Expand All @@ -39,14 +39,14 @@ let char_before loc =
{ line; column }
in
let _end = loc.start in
{ loc with start; _end }
{ loc with start; _end } *)

(* Returns the location of the first character in the given loc. Not accurate if the
* first line is a newline character, but is still consistent with loc orderings. *)
let first_char loc =
(* let first_char loc =
let start = loc.start in
let _end = { start with column = start.column + 1 } in
{ loc with _end }
{ loc with _end } *)

let pos_cmp a b =
let k = a.line - b.line in
Expand All @@ -60,7 +60,7 @@ let pos_cmp a b =
* If `b` starts before `a` (even if it ends inside), returns < 0.
* If `b` ends after `a` (even if it starts inside), returns > 0.
*)
let span_compare a b =
(* let span_compare a b =
let k = File_key.compare_opt a.source b.source in
if k = 0 then
let k = pos_cmp a.start b.start in
Expand All @@ -73,15 +73,15 @@ let span_compare a b =
else
1
else
k
k *)

(* Returns true if loc1 entirely overlaps loc2 *)
let contains loc1 loc2 = span_compare loc1 loc2 = 0
(* let contains loc1 loc2 = span_compare loc1 loc2 = 0 *)

(* Returns true if loc1 intersects loc2 at all *)
let lines_intersect loc1 loc2 =
(* let lines_intersect loc1 loc2 =
File_key.compare_opt loc1.source loc2.source = 0
&& not (loc1._end.line < loc2.start.line || loc1.start.line > loc2._end.line)
&& not (loc1._end.line < loc2.start.line || loc1.start.line > loc2._end.line) *)

let compare loc1 loc2 =
let k = File_key.compare_opt loc1.source loc2.source in
Expand All @@ -94,13 +94,13 @@ let compare loc1 loc2 =
else
k

let equal loc1 loc2 = compare loc1 loc2 = 0
(* let equal loc1 loc2 = compare loc1 loc2 = 0 *)

(**
* This is mostly useful for debugging purposes.
* Please don't dead-code delete this!
*)
let debug_to_string ?(include_source = false) loc =
(* let debug_to_string ?(include_source = false) loc =
let source =
if include_source then
Printf.sprintf
Expand All @@ -119,9 +119,9 @@ let debug_to_string ?(include_source = false) loc =
loc._end.line
loc._end.column
in
source ^ pos
source ^ pos *)

let to_string_no_source loc =
(* let to_string_no_source loc =
let line = loc.start.line in
let start = loc.start.column + 1 in
let end_ = loc._end.column in
Expand All @@ -141,4 +141,4 @@ let make file line col =

let start_loc loc = { loc with _end = loc.start }

let end_loc loc = { loc with start = loc._end }
let end_loc loc = { loc with start = loc._end } *)
12 changes: 6 additions & 6 deletions jscomp/js_parser/loc.mli
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ val none : t

val btwn : t -> t -> t

val char_before : t -> t
(* val char_before : t -> t

val first_char : t -> t

Expand All @@ -32,16 +32,16 @@ val lines_intersect : t -> t -> bool

val pos_cmp : position -> position -> int

val span_compare : t -> t -> int
val span_compare : t -> t -> int *)

val compare : t -> t -> int

val equal : t -> t -> bool
(* val equal : t -> t -> bool

val debug_to_string : ?include_source:bool -> t -> string
val debug_to_string : ?include_source:bool -> t -> string *)

(* Relatively compact; suitable for use as a unique string identifier *)
val to_string_no_source : t -> string
(* val to_string_no_source : t -> string

val source : t -> File_key.t option

Expand All @@ -52,4 +52,4 @@ val make : File_key.t -> int -> int -> t
val start_loc : t -> t

(* Produces a location at the end of the input location *)
val end_loc : t -> t
val end_loc : t -> t *)
2 changes: 1 addition & 1 deletion jscomp/js_parser/parse_error.ml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ type t =

exception Error of (Loc.t * t) list

let error loc e = raise (Error [(loc, e)])
(* let error loc e = raise (Error [(loc, e)]) *)

module PP = struct
let error = function
Expand Down
Loading