Skip to content

Commit 565fb57

Browse files
committed
Remove Pexp_function, which is never produced by the parser.
1 parent ba78715 commit 565fb57

19 files changed

+11
-43
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- Ast cleanup: explicit representation for optional record fields in types. https://github.com/rescript-lang/rescript/pull/7190 https://github.com/rescript-lang/rescript/pull/7191
2525
- AST cleanup: first-class expression and patterns for records with optional fields. https://github.com/rescript-lang/rescript/pull/7192
2626
- AST cleanup: Represent the arity of uncurried function definitions directly in the AST. https://github.com/rescript-lang/rescript/pull/7197
27+
- AST cleanup: Remove Pexp_function from the AST. https://github.com/rescript-lang/rescript/pull/7198
2728

2829

2930
# 12.0.0-alpha.5

analysis/src/DocumentSymbol.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ let command ~path =
4141
let rec exprKind (exp : Parsetree.expression) =
4242
match exp.pexp_desc with
4343
| Pexp_fun _ -> Function
44-
| Pexp_function _ -> Function
4544
| Pexp_constraint (e, _) -> exprKind e
4645
| Pexp_constant (Pconst_string _) -> String
4746
| Pexp_constant (Pconst_float _ | Pconst_integer _) -> Number

analysis/src/Utils.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ let identifyPexp pexp =
8585
| Parsetree.Pexp_ident _ -> "Pexp_ident"
8686
| Pexp_constant _ -> "Pexp_constant"
8787
| Pexp_let _ -> "Pexp_let"
88-
| Pexp_function _ -> "Pexp_function"
8988
| Pexp_fun _ -> "Pexp_fun"
9089
| Pexp_apply _ -> "Pexp_apply"
9190
| Pexp_match _ -> "Pexp_match"

compiler/frontend/bs_ast_mapper.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ module E = struct
319319
fun_ ~loc ~attrs ~arity lab
320320
(map_opt (sub.expr sub) def)
321321
(sub.pat sub p) (sub.expr sub e)
322-
| Pexp_function pel -> function_ ~loc ~attrs (sub.cases sub pel)
323322
| Pexp_apply (e, l) ->
324323
apply ~loc ~attrs (sub.expr sub e) (List.map (map_snd (sub.expr sub)) l)
325324
| Pexp_match (e, pel) ->

compiler/frontend/bs_builtin_ppx.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ let expr_mapper ~async_context ~in_function_def (self : mapper)
110110
| Pexp_constant (Pconst_integer (s, Some 'l')) ->
111111
{e with pexp_desc = Pexp_constant (Pconst_integer (s, None))}
112112
(* End rewriting *)
113-
| Pexp_function _ ->
114-
async_context := false;
115-
default_expr_mapper self e
116113
| _
117114
when Ast_uncurried.expr_is_uncurried_fun e
118115
&&

compiler/ml/ast_helper.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ module Exp = struct
152152
let let_ ?loc ?attrs a b c = mk ?loc ?attrs (Pexp_let (a, b, c))
153153
let fun_ ?loc ?attrs ~arity a b c d =
154154
mk ?loc ?attrs (Pexp_fun (a, b, c, d, arity))
155-
let function_ ?loc ?attrs a = mk ?loc ?attrs (Pexp_function a)
156155
let apply ?loc ?attrs a b = mk ?loc ?attrs (Pexp_apply (a, b))
157156
let match_ ?loc ?attrs a b = mk ?loc ?attrs (Pexp_match (a, b))
158157
let try_ ?loc ?attrs a b = mk ?loc ?attrs (Pexp_try (a, b))

compiler/ml/ast_helper.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ module Exp : sig
138138
pattern ->
139139
expression ->
140140
expression
141-
val function_ : ?loc:loc -> ?attrs:attrs -> case list -> expression
142141
val apply :
143142
?loc:loc ->
144143
?attrs:attrs ->

compiler/ml/ast_iterator.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ module E = struct
286286
iter_opt (sub.expr sub) def;
287287
sub.pat sub p;
288288
sub.expr sub e
289-
| Pexp_function pel -> sub.cases sub pel
290289
| Pexp_apply (e, l) ->
291290
sub.expr sub e;
292291
List.iter (iter_snd (sub.expr sub)) l

compiler/ml/ast_mapper.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ module E = struct
282282
fun_ ~loc ~attrs ~arity lab
283283
(map_opt (sub.expr sub) def)
284284
(sub.pat sub p) (sub.expr sub e)
285-
| Pexp_function pel -> function_ ~loc ~attrs (sub.cases sub pel)
286285
| Pexp_apply (e, l) ->
287286
apply ~loc ~attrs (sub.expr sub e) (List.map (map_snd (sub.expr sub)) l)
288287
| Pexp_match (e, pel) ->

compiler/ml/ast_mapper_from0.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ module E = struct
288288
fun_ ~loc ~attrs ~arity:None lab
289289
(map_opt (sub.expr sub) def)
290290
(sub.pat sub p) (sub.expr sub e)
291-
| Pexp_function pel -> function_ ~loc ~attrs (sub.cases sub pel)
291+
| Pexp_function _ -> assert false
292292
| Pexp_apply (e, l) ->
293293
apply ~loc ~attrs (sub.expr sub e) (List.map (map_snd (sub.expr sub)) l)
294294
| Pexp_match (e, pel) ->

0 commit comments

Comments
 (0)