-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathflow_ast_utils.mli
128 lines (98 loc) · 3.4 KB
/
flow_ast_utils.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
(*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
type 'loc binding = 'loc * string
type 'loc ident = 'loc * string
type 'loc source = 'loc * string
val fold_bindings_of_pattern :
('a -> ('m, 't) Flow_ast.Identifier.t -> 'a) -> 'a -> ('m, 't) Flow_ast.Pattern.t -> 'a
val fold_bindings_of_variable_declarations :
(bool -> 'a -> ('m, 't) Flow_ast.Identifier.t -> 'a) ->
'a ->
('m, 't) Flow_ast.Statement.VariableDeclaration.Declarator.t list ->
'a
val partition_directives :
(Loc.t, Loc.t) Flow_ast.Statement.t list ->
(Loc.t, Loc.t) Flow_ast.Statement.t list * (Loc.t, Loc.t) Flow_ast.Statement.t list
val hoist_function_declarations :
('a, 'b) Flow_ast.Statement.t list -> ('a, 'b) Flow_ast.Statement.t list
val is_call_to_invariant : ('a, 'b) Flow_ast.Expression.t -> bool
val is_call_to_is_array : ('a, 'b) Flow_ast.Expression.t -> bool
val is_call_to_object_dot_freeze : ('a, 'b) Flow_ast.Expression.t -> bool
val is_call_to_object_static_method : ('a, 'b) Flow_ast.Expression.t -> bool
val negate_number_literal : float * string -> float * string
val loc_of_expression : ('a, 'a) Flow_ast.Expression.t -> 'a
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 name_of_ident : ('loc, 'a) Flow_ast.Identifier.t -> string
val source_of_ident : ('a, 'a) Flow_ast.Identifier.t -> 'a source
val ident_of_source :
?comments:('a, unit) Flow_ast.Syntax.t -> 'a source -> ('a, 'a) Flow_ast.Identifier.t
val mk_comments :
?leading:'loc Flow_ast.Comment.t list ->
?trailing:'loc Flow_ast.Comment.t list ->
'a ->
('loc, 'a) Flow_ast.Syntax.t
val mk_comments_opt :
?leading:'loc Flow_ast.Comment.t list ->
?trailing:'loc Flow_ast.Comment.t list ->
unit ->
('loc, unit) Flow_ast.Syntax.t option
val mk_comments_with_internal_opt :
?leading:'loc Flow_ast.Comment.t list ->
?trailing:'loc Flow_ast.Comment.t list ->
internal:'loc Flow_ast.Comment.t list ->
unit ->
('loc, 'loc Flow_ast.Comment.t list) Flow_ast.Syntax.t option
val merge_comments :
inner:('M, unit) Flow_ast.Syntax.t option ->
outer:('M, unit) Flow_ast.Syntax.t option ->
('M, unit) Flow_ast.Syntax.t option
val merge_comments_with_internal :
inner:('M, 'loc Flow_ast.Comment.t list) Flow_ast.Syntax.t option ->
outer:('M, 'a) Flow_ast.Syntax.t option ->
('M, 'loc Flow_ast.Comment.t list) Flow_ast.Syntax.t option
val split_comments :
('loc, unit) Flow_ast.Syntax.t option ->
('loc, unit) Flow_ast.Syntax.t option * ('loc, unit) Flow_ast.Syntax.t option
module ExpressionSort : sig
type t =
| Array
| ArrowFunction
| Assignment
| Binary
| Call
| Class
| Comprehension
| Conditional
| Function
| Generator
| Identifier
| Import
| JSXElement
| JSXFragment
| Literal
| Logical
| Member
| MetaProperty
| New
| Object
| OptionalCall
| OptionalMember
| Sequence
| Super
| TaggedTemplate
| TemplateLiteral
| This
| TypeCast
| Unary
| Update
| Yield
val to_string : t -> string
end
val string_of_assignment_operator : Flow_ast.Expression.Assignment.operator -> string
val string_of_binary_operator : Flow_ast.Expression.Binary.operator -> string