File tree Expand file tree Collapse file tree 6 files changed +18
-31
lines changed Expand file tree Collapse file tree 6 files changed +18
-31
lines changed Original file line number Diff line number Diff line change @@ -348,8 +348,7 @@ and pexp' =
348
348
| PEXP_custom of name * (pexp array ) * (string option )
349
349
350
350
and plval =
351
- PLVAL_ident of ident
352
- | PLVAL_app of (ident * (ty array ))
351
+ PLVAL_base of name_base
353
352
| PLVAL_ext_name of (pexp * name_component)
354
353
| PLVAL_ext_pexp of (pexp * pexp)
355
354
| PLVAL_ext_deref of pexp
@@ -555,8 +554,7 @@ let sane_name (n:name) : bool =
555
554
556
555
let rec plval_is_atomic (plval :plval ) : bool =
557
556
match plval with
558
- PLVAL_ident _
559
- | PLVAL_app _ -> true
557
+ PLVAL_base _ -> true
560
558
561
559
| PLVAL_ext_name (p , _ ) ->
562
560
pexp_is_atomic p
@@ -1039,10 +1037,7 @@ and fmt_pexp (ff:Format.formatter) (pexp:pexp) : unit =
1039
1037
1040
1038
and fmt_plval (ff :Format.formatter ) (plval :plval ) : unit =
1041
1039
match plval with
1042
- PLVAL_ident id -> fmt_ident ff id
1043
- | PLVAL_app (id , tys ) ->
1044
- fmt_ident ff id;
1045
- fmt_bracketed_arr_sep " [" " ]" " ," fmt_ty ff tys
1040
+ PLVAL_base nb -> fmt_name_base ff nb
1046
1041
1047
1042
| PLVAL_ext_name (pexp , nc ) ->
1048
1043
fmt_pexp ff pexp;
Original file line number Diff line number Diff line change @@ -520,7 +520,7 @@ and eval_pexp (env:env) (exp:Ast.pexp) : pval =
520
520
| _ -> bug () " Unexpected unop in Cexp.eval_pexp"
521
521
end
522
522
523
- | Ast. PEXP_lval (Ast. PLVAL_ident ident ) ->
523
+ | Ast. PEXP_lval (Ast. PLVAL_base ( Ast. BASE_ident ident ) ) ->
524
524
begin
525
525
match ltab_search ! (env.env_bindings) ident with
526
526
None -> raise (err (Printf. sprintf " no binding for '%s' found"
Original file line number Diff line number Diff line change @@ -559,13 +559,13 @@ and parse_bottom_pexp (ps:pstate) : Ast.pexp =
559
559
(Some COMMA ) parse_ty) ps
560
560
in
561
561
let bpos = lexpos ps in
562
- span ps apos bpos (Ast. PEXP_lval (Ast. PLVAL_app ( i, tys)))
562
+ span ps apos bpos (Ast. PEXP_lval (Ast. PLVAL_base ( Ast. BASE_app ( i, tys) )))
563
563
end
564
564
565
565
| _ ->
566
566
begin
567
567
let bpos = lexpos ps in
568
- span ps apos bpos (Ast. PEXP_lval (Ast. PLVAL_ident i ))
568
+ span ps apos bpos (Ast. PEXP_lval (Ast. PLVAL_base ( Ast. BASE_ident i) ))
569
569
end
570
570
end
571
571
@@ -960,13 +960,8 @@ let rec desugar_lval (ps:pstate) (pexp:Ast.pexp)
960
960
let (apos, bpos) = (s.lo, s.hi) in
961
961
match pexp.node with
962
962
963
- Ast. PEXP_lval (Ast. PLVAL_ident ident ) ->
964
- let nb = span ps apos bpos (Ast. BASE_ident ident) in
965
- ([||], Ast. LVAL_base nb)
966
-
967
- | Ast. PEXP_lval (Ast. PLVAL_app (ident , tys )) ->
968
- let nb = span ps apos bpos (Ast. BASE_app (ident, tys)) in
969
- ([||], Ast. LVAL_base nb)
963
+ Ast. PEXP_lval (Ast. PLVAL_base nb ) ->
964
+ ([||], Ast. LVAL_base (span ps apos bpos nb))
970
965
971
966
| Ast. PEXP_lval (Ast. PLVAL_ext_name (base_pexp , comp )) ->
972
967
let (base_stmts, base_atom) = desugar_expr_atom ps base_pexp in
Original file line number Diff line number Diff line change @@ -492,9 +492,9 @@ let type_resolving_visitor
492
492
inner.Walk. visit_pexp_post p;
493
493
let rebuild_plval pl =
494
494
match pl with
495
- Ast. PLVAL_ident _ -> pl
496
- | Ast. PLVAL_app ( id , tys ) ->
497
- Ast. PLVAL_app (id, Array. map resolve_ty tys)
495
+ Ast. PLVAL_base ( Ast. BASE_app ( id , tys )) ->
496
+ Ast. PLVAL_base ( Ast. BASE_app ( id, Array. map resolve_ty tys))
497
+ | Ast. PLVAL_base _ -> pl
498
498
| Ast. PLVAL_ext_name (pexp , nc ) ->
499
499
let pexp = get_rebuilt_pexp pexp in
500
500
let nc =
@@ -668,8 +668,8 @@ let lval_base_resolving_visitor
668
668
Ast. PEXP_lval pl ->
669
669
begin
670
670
match pl with
671
- (Ast. PLVAL_ident ident )
672
- | (Ast. PLVAL_app ( ident , _ )) ->
671
+ (Ast. PLVAL_base ( Ast. BASE_ident ident ) )
672
+ | (Ast. PLVAL_base ( Ast. BASE_app ( ident , _ ) )) ->
673
673
let id = lookup_defn_by_ident p.id ident in
674
674
675
675
iflog cx
Original file line number Diff line number Diff line change @@ -579,10 +579,8 @@ let rec lval_to_name (lv:Ast.lval) : Ast.name =
579
579
580
580
let rec plval_to_name (pl :Ast.plval ) : Ast.name =
581
581
match pl with
582
- Ast. PLVAL_ident ident ->
583
- Ast. NAME_base (Ast. BASE_ident ident)
584
- | Ast. PLVAL_app (ident , tys ) ->
585
- Ast. NAME_base (Ast. BASE_app (ident, tys))
582
+ Ast. PLVAL_base nb ->
583
+ Ast. NAME_base nb
586
584
| Ast. PLVAL_ext_name ({node = Ast. PEXP_lval pl } , nc ) ->
587
585
Ast. NAME_ext (plval_to_name pl, nc)
588
586
| _ -> bug () " plval_to_name with plval that contains non-name components"
@@ -1431,8 +1429,7 @@ let rec pexp_is_const (cx:ctxt) (pexp:Ast.pexp) : bool =
1431
1429
1432
1430
and plval_is_const (cx :ctxt ) (plval :Ast.plval ) : bool =
1433
1431
match plval with
1434
- Ast. PLVAL_ident _
1435
- | Ast. PLVAL_app _ ->
1432
+ Ast. PLVAL_base _ ->
1436
1433
bug () " Semant.plval_is_const on plval base"
1437
1434
1438
1435
| Ast. PLVAL_ext_name (pexp , _ ) ->
Original file line number Diff line number Diff line change @@ -631,9 +631,9 @@ and walk_plval
631
631
: unit =
632
632
let children _ =
633
633
match p with
634
- Ast. PLVAL_ident _ -> ()
635
- | Ast. PLVAL_app (_ , tys ) ->
634
+ | Ast. PLVAL_base (Ast. BASE_app (_ , tys )) ->
636
635
Array. iter (walk_ty v) tys
636
+ | Ast. PLVAL_base _ -> ()
637
637
| Ast. PLVAL_ext_name (pexp , _ ) ->
638
638
walk_pexp v pexp
639
639
| Ast. PLVAL_ext_pexp (a , b ) ->
You can’t perform that action at this time.
0 commit comments