add PRecord, marche pas mais je l'ai fais quand même
This commit is contained in:
parent
4b32388ae7
commit
b1cade7dd4
1 changed files with 22 additions and 3 deletions
|
@ -439,7 +439,6 @@ and expression pos environment memory = function
|
|||
| TypeAnnotation _ -> VUnit
|
||||
(* On ignore le type car on interprète *)
|
||||
|
||||
(* TODO a finir (à commencer plutôt) *)
|
||||
and case_value expr branches environment memory =
|
||||
(* On calcule d'abord l'expression *)
|
||||
let expr' = expression' environment memory expr in
|
||||
|
@ -604,9 +603,29 @@ and tuple_pattern environment tab tab2 =
|
|||
and tagged_pattern cons1 cons2 pattern1 pattern2 environment =
|
||||
if cons1.value = cons2 then tuple_pattern environment pattern1 pattern2 else None
|
||||
|
||||
|
||||
and record_pattern environment r r' =
|
||||
(* TODO *)
|
||||
None
|
||||
(*)
|
||||
match r with
|
||||
| [] -> Some environment
|
||||
| field :: reste ->
|
||||
let labbel_pattern = record_labbel_pattern environment field r' in
|
||||
match labbel_pattern with
|
||||
| Some env' -> record_pattern env' reste r'
|
||||
| None -> None
|
||||
|
||||
|
||||
and record_labbel_pattern environment field r' =
|
||||
match r' with
|
||||
| [] -> None
|
||||
| (label,pat) :: reste ->
|
||||
if (value (fst field)) = label then
|
||||
match pattern environment (value (snd field)) pat with
|
||||
| Some env' -> Some env'
|
||||
| None -> record_labbel_pattern environment field reste
|
||||
else
|
||||
record_labbel_pattern environment field reste
|
||||
*)
|
||||
|
||||
and literal_pattern pl environment expression =
|
||||
let valeur_literal = pl.value in
|
||||
|
|
Reference in a new issue