Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Move parseSpecification and parseImplementation outside of let rec #515

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/res_core.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5329,11 +5329,6 @@ and parseExceptionDef ~attrs p =
let loc = mkLoc startPos p.prevEndPos in
Ast_helper.Te.constructor ~loc ~attrs name kind

(* module structure on the file level *)
and parseImplementation p : Parsetree.structure =
parseRegion p ~grammar:Grammar.Implementation ~f:parseStructureItemRegion
[@@progress (Parser.next, Parser.expect, Parser.checkProgress)]

and parseNewlineOrSemicolonStructure p =
match p.Parser.token with
| Semicolon ->
Expand Down Expand Up @@ -6070,11 +6065,6 @@ and parseModuleTypeOf p =
let moduleExpr = parseModuleExpr p in
Ast_helper.Mty.typeof_ ~loc:(mkLoc startPos p.prevEndPos) moduleExpr

(* module signature on the file level *)
and parseSpecification p =
parseRegion ~grammar:Grammar.Specification ~f:parseSignatureItemRegion p
[@@progress (Parser.next, Parser.expect, Parser.checkProgress)]

and parseNewlineOrSemicolonSignature p =
match p.Parser.token with
| Semicolon ->
Expand Down Expand Up @@ -6452,3 +6442,13 @@ and parseExtension ?(moduleLanguage=false) p =
let attrId = parseAttributeId ~startPos p in
let payload = parsePayload p in
(attrId, payload)

(* module signature on the file level *)
let parseSpecification p : Parsetree.signature =
parseRegion p ~grammar:Grammar.Specification ~f:parseSignatureItemRegion
[@@progress (Parser.next, Parser.expect, Parser.checkProgress)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These annotations go on recursive functions, or the check won't fire.
Moved to parseSignatureItemRegion and parseStructureItemRegion in a PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cristianoc Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, sorry about merging so eagerly


(* module structure on the file level *)
let parseImplementation p : Parsetree.structure =
parseRegion p ~grammar:Grammar.Implementation ~f:parseStructureItemRegion
[@@progress (Parser.next, Parser.expect, Parser.checkProgress)]