diff options
author | Son Ho | 2022-02-04 10:22:35 +0100 |
---|---|---|
committer | Son Ho | 2022-02-04 10:22:35 +0100 |
commit | 3c906b905e3ba957d193c168a6c84ece06136a1e (patch) | |
tree | 2e637a7e45176960d98e03584ac0096ae20a34d9 /src/Pure.ml | |
parent | e24b71934f7d1070caf7dbfd1bdaa31072b9b4aa (diff) |
Merge the switches over integers and the matches over enumerations in
the pure AST
Diffstat (limited to 'src/Pure.ml')
-rw-r--r-- | src/Pure.ml | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Pure.ml b/src/Pure.ml index 428246dd..c773d613 100644 --- a/src/Pure.ml +++ b/src/Pure.ml @@ -264,7 +264,12 @@ type var_or_dummy = }] (** A left value (which appears on the left of assignments *) -type lvalue = LvVar of var_or_dummy | LvAdt of adt_lvalue +type lvalue = + | LvConcrete of constant_value + (** [LvConcrete] is necessary because we merge the switches over integer + values and the matches over enumerations *) + | LvVar of var_or_dummy + | LvAdt of adt_lvalue and adt_lvalue = { variant_id : (VariantId.id option[@opaque]); @@ -505,12 +510,7 @@ and call = { *) } -and switch_body = - | If of texpression * texpression - | SwitchInt of integer_type * (scalar_value * texpression) list * texpression - | Match of match_branch list -(* TODO: merge SwitchInt and Match. In order to do that, - * we need to add constants to lvalues. *) +and switch_body = If of texpression * texpression | Match of match_branch list and match_branch = { pat : typed_lvalue; branch : texpression } |