camlspotter avatar camlspotter committed 7d8f5bc

-> pre fix

Comments (0)

Files changed (2)

         bases,
         { k = KModule cols; indent = cols + 2; } :: bases
 
+    | VAL ->
+        let bases = unwind_top bases0 in
+        bases,
+        { k = KVal; indent = cols + 2; } :: bases
+
     | LET when is_top_let state.last_token ->
         let bases = unwind_top bases0 in
         bases,
     | LET ->
         bases0, { k = KLet (`Local, cols); indent = cols + 2; } :: bases0
 
-    | VAL ->
-        let bases = unwind_top bases0 in
-        bases,
-        { k = KVal; indent = cols + 2; } :: bases
-
     | EQUAL ->
         (* CR jfuruse: TODO
            - pre bases
 
     | AND ->
         (* for let *)
-        (* recover the last let *)
+        (* recover the last let, type, module *)
         let rec f bases = match bases with
           | {k = (KLet (_,cols) | KType cols | KModule cols) } :: _ ->
               fix cols, bases
     | MINUSGREATER ->
         let rec f bases = match bases with
           | { k = (KWith cols) } :: _ ->
-              bases0,
+              fix (cols + 4),
               { k = KCaseArrow; indent = cols + 4; } :: bases
           | { k = (KFunction cols) } :: _ ->
-              bases0,
+              fix (cols + 4),
               { k = KCaseArrow; indent = cols + 6; } :: bases
           | { k = (KFun cols) } :: _ ->
-              bases0,
+              fix (cols + 2),
               { k = KCaseArrow; indent = cols + 2; } :: bases
           | [] -> bases0, bases0 (* if overrun, keep the original *)
           | _ :: bs -> f bs

tests/arrow_after_or_pattern.ml

+let rec is_top_let = function
+  | None -> true
+  | Some t ->
+      match t with
+      | COMMENT -> assert false (* COMMENT must be skipped *)
+      | COLON | CLASS | BARRBRACKET
+        -> true
+      | COLON | CLASS | BARRBRACKET
+        -> 
+          true
+      | _ -> 
+          false
+
+let f = fun x y z 
+  -> 3
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.