The paren printer breaks an if-let as it breaks an if, and a one-key dyn get takes no slot.
This commit is contained in:
parent
62fd7b19bc
commit
8d08e82b7c
@ -11016,9 +11016,14 @@ and checked_get ctx ~want loc (target : Tast.expr) (idx : Ast.expr list) =
|
||||
and dyn_get ctx ~want loc (target : Tast.expr) (keys : Ast.expr list) =
|
||||
let nil () = rt loc Types.Dyn "flan_dyn_nil" [] in
|
||||
let one v k = rt loc Types.Dyn "flan_dyn_get_at" [ v; k; here loc ] in
|
||||
(* A slot per key only when there are several: one key is passed as it
|
||||
stands, so a single-key get compiles as it always did. *)
|
||||
let slotted = List.length keys > 1 in
|
||||
let keys =
|
||||
map_lr
|
||||
(fun k -> (fresh_slot ctx Types.Dyn, check ctx ~want:Types.Dyn k))
|
||||
(fun k ->
|
||||
let v = check ctx ~want:Types.Dyn k in
|
||||
((if slotted then fresh_slot ctx Types.Dyn else -1), v))
|
||||
keys
|
||||
in
|
||||
let kvar (s, _) = mk loc Types.Dyn (Tast.Local s) in
|
||||
|
||||
@ -38,7 +38,7 @@ let rec flat spell (f : Form.t) =
|
||||
(* Heads whose arguments are statements or clauses rather than values: these
|
||||
break one argument to a line, never filled. *)
|
||||
let statement_heads =
|
||||
[ "let"; "loop"; "set"; "if"; "when"; "unless"; "cond"; "while"; "until";
|
||||
[ "let"; "loop"; "set"; "if"; "if-let"; "when"; "unless"; "cond"; "while"; "until";
|
||||
"dotimes"; "match"; "handler-case"; "handler-bind"; "restart-case";
|
||||
"return"; "defer"; "do"; "fn"; "with-allocator"; "comment"; "quasiquote";
|
||||
"break"; "continue" ]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user