Skip to content

Commit

Permalink
feat(grainfmt): Drastically improve performance (#1042)
Browse files Browse the repository at this point in the history
fix(grainfmt): Improve correctness of formatting
chore(grainfmt): Refactor comment handling
chore(grainfmt): Refactor some code printing
fix(compiler): Correctly supply locations for types & variants
  • Loading branch information
marcusroberts committed Dec 31, 2021
1 parent c227130 commit 9bc7a55
Show file tree
Hide file tree
Showing 41 changed files with 5,083 additions and 4,104 deletions.
543 changes: 543 additions & 0 deletions compiler/grainformat/comment_utils.re

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions compiler/grainformat/debug.re
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,7 @@ let debug_pattern = (pat: Parsetree.pattern) => {
| PPatAlias(pattern, loc) => print_endline("PPatAlias")
};
};

let print_comments = (comments: list(Grain_parsing.Parsetree.comment)) => {
List.map(Comments.print_comment, comments);
};
10 changes: 5 additions & 5 deletions compiler/grainformat/dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(library
(name reformat)
(public_name grainformat.reformat)
(modules reformat res_doc res_minibuffer walktree debug)
(name format)
(public_name grainformat.format)
(modules format res_doc res_minibuffer debug comment_utils)
(libraries grain grain_diagnostics grain_parsing grain_utils))

(executable
Expand All @@ -14,7 +14,7 @@
(flags
(:standard
(:include ./config/flags.sexp)))
(libraries cmdliner grain grain_utils grain_parsing grainformat.reformat
(libraries cmdliner grain grain_utils grain_parsing grainformat.format
binaryen.native dune-build-info))

(rule
Expand All @@ -32,6 +32,6 @@
; exe is only here so dune-build-info works
(modes exe js)
(libraries cmdliner grain grain_diagnostics grain_utils grain_parsing
grainformat.reformat binaryen.js dune-build-info)
grainformat.format binaryen.js dune-build-info)
(js_of_ocaml
(flags --no-sourcemap --no-extern-fs --quiet)))

0 comments on commit 9bc7a55

Please sign in to comment.