Skip to content

Commit

Permalink
docgen workaround fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-snezhko committed Apr 25, 2023
1 parent 1180343 commit 430df72
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compiler/graindoc/docblock.re
Expand Up @@ -493,11 +493,16 @@ and for_signature_items =
~module_namespace,
~name,
~loc: Grain_parsing.Location.t,
~has_attrs=false,
signature_items,
) => {
let comments = get_comments_from_loc(loc);
let addl_offset = if (has_attrs) {1} else {0};
let comment =
Comments.Doc.ending_on(~lnum=loc.loc_start.pos_lnum - 1, comments);
Comments.Doc.ending_on(
~lnum=loc.loc_start.pos_lnum - (1 + addl_offset),
comments,
);

let (description, attributes) =
switch (comment) {
Expand Down
1 change: 1 addition & 0 deletions compiler/graindoc/graindoc.re
Expand Up @@ -92,6 +92,7 @@ let generate_docs =
~module_namespace=None,
~name=module_name,
~loc=program.module_name.loc,
~has_attrs=program.has_flags,
signature_items,
);

Expand Down
1 change: 1 addition & 0 deletions compiler/src/typed/typedtree.re
Expand Up @@ -611,6 +611,7 @@ type comment =

[@deriving sexp]
type typed_program = {
has_flags: bool,
module_name: loc(string),
statements: list(toplevel_stmt),
env: [@sexp.opaque] Env.t,
Expand Down
1 change: 1 addition & 0 deletions compiler/src/typed/typedtree.rei
Expand Up @@ -572,6 +572,7 @@ type comment =

[@deriving sexp]
type typed_program = {
has_flags: bool,
module_name: loc(string),
statements: list(toplevel_stmt),
env: Env.t,
Expand Down
2 changes: 2 additions & 0 deletions compiler/src/typed/typemod.re
Expand Up @@ -1020,6 +1020,8 @@ let type_implementation = prog => {
let signature =
Env.build_signature(normalized_sig, module_name, filename, type_metadata);
{
has_flags:
prog.compile_flags.no_pervasives || prog.compile_flags.runtime_mode,
module_name: prog.module_name,
statements,
env: finalenv,
Expand Down

0 comments on commit 430df72

Please sign in to comment.