syntax
syntax copied to clipboard
resdoc: add support for .ml and .res files
Building on the experimental-docgen branch.
Fixes rescript-association/rescript-lang.org#359
A problem with the current Ast_iterator approach for structure files is that it recurses into functions, while we only want to document top level stuff.
I've been looking at a way to convert a structure into a signature, but I can't find it in the codebase. However, the new dump subcommand does something similar. Maybe we can use that?
-
Regarding
Ast_iterator, maybe it's ok to just write your own recursive functions that walk the tree? This way you have full control. -
Converting a
structureinto asignatureis not possible without access to the type checker.
@IwanKaramazow Thanks for the tips!
I initially thought using Ast_iterator would be better, but I think I'll revert to @ryyppy's approach.
(Random thought: Control flow is one of the only tools we have as programmers, sometimes it's not worth to give it up.)
The rescript-lang/syntax repo is obsolete and will be archived soon. If this issue is still relevant, please reopen in the compiler repo (https://github.com/rescript-lang/rescript-compiler) or comment here to ask for it to be moved. Thank you for your contributions.