A let in a form cut from inside a body stays local when the editor sends it, and the printer forgets one file's class names before the next.
This commit is contained in:
parent
702ebdc9c5
commit
a8f98c86f1
@ -1267,6 +1267,7 @@ let program ?source ?macros:m (fs : Form.t list) : string =
|
|||||||
in
|
in
|
||||||
spelling := (fun _ -> None);
|
spelling := (fun _ -> None);
|
||||||
inside := (fun _ -> false);
|
inside := (fun _ -> false);
|
||||||
|
classes := [];
|
||||||
(* With the source, its comments go back where they were; without it the
|
(* With the source, its comments go back where they were; without it the
|
||||||
tags come out and nothing goes in. *)
|
tags come out and nothing goes in. *)
|
||||||
Source_text.weave ~starts:(Source_text.form_starts fs)
|
Source_text.weave ~starts:(Source_text.form_starts fs)
|
||||||
|
|||||||
@ -72,9 +72,11 @@ let read_paren ?(line = 1) ?(col = 1) ~file src =
|
|||||||
in
|
in
|
||||||
go []
|
go []
|
||||||
|
|
||||||
(** Editor code, in the request's syntax and at its position. With [expr], an
|
(** Editor code, in the request's syntax and at its position. With [expr],
|
||||||
indented snippet of several statements is one expression, [(do ...)]: a
|
an indented snippet of several statements is one expression,
|
||||||
block of lines means its lines in order. *)
|
[(do ...)]: a block of lines means its lines in order. A [let] is a
|
||||||
|
global only in code from column 1 that is not an expression: a form cut
|
||||||
|
from inside a body, for a macroexpansion say, keeps its lets local. *)
|
||||||
let read_code ?(expr = false) ~file code =
|
let read_code ?(expr = false) ~file code =
|
||||||
let line, col =
|
let line, col =
|
||||||
match !code_at with Some (l, c) -> (l, c) | None -> (1, 1)
|
match !code_at with Some (l, c) -> (l, c) | None -> (1, 1)
|
||||||
@ -82,7 +84,7 @@ let read_code ?(expr = false) ~file code =
|
|||||||
match !code_syntax with
|
match !code_syntax with
|
||||||
| Paren -> read_paren ~line ~col ~file code
|
| Paren -> read_paren ~line ~col ~file code
|
||||||
| Indented ->
|
| Indented ->
|
||||||
(match Indent_reader.read_all ~line ~col ?indent:!code_indent ~global_let:(not expr)
|
(match Indent_reader.read_all ~line ~col ?indent:!code_indent ~global_let:(not expr && col = 1)
|
||||||
~file code with
|
~file code with
|
||||||
| (first :: _ :: _ as forms) when expr ->
|
| (first :: _ :: _ as forms) when expr ->
|
||||||
let last = List.nth forms (List.length forms - 1) in
|
let last = List.nth forms (List.length forms - 1) in
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user