Skip to content

Conversation

gpetiot
Copy link
Collaborator

@gpetiot gpetiot commented Oct 24, 2022

This is a WIP not ready for review.

Julow and others added 30 commits November 2, 2022 16:55
This adds an opportunity delay a computation but also returns a more
general result.
Some refactoring to remove repeated prefixes.
We construct a shape as a query and it seems that the reducer is
returning that shape instead of a shape with valid Uids.
The low level code is closer to the loader and xref2/Env provides a
simpler interface.

To go a step further, 'shape', 'ocaml_env' and 'uid_to_loc' should be
removed from Lang.
Remove 'shape', 'ocaml_env' and 'uid_to_loc' from Lang and pass them to
the resolver separately.

These values are optional but must be passed all together and shouldn't
be stored in .odoc files because they won't be used again.

The typing environment is read when reading a .cmt.
When loading a .cmti, the typing env is read from a .cmt with the same
base pathname.
When loading a .cmi, no attempt is made to load the typing env. If a
.cmt was available, it would have been used instead.
The uid needed to lookup the location is queryied using shapes. The
query is constructed by projecting an identifier on top of the
"impl_shape".

Using "Shape.local_reduce" because we don't need to lookup anything from
other units.
"odoc compile" now triggers a warning when the implementation couldn't
be found.

Tests generally don't build any implementation so the warning happen a
lot.
Locations of implementations and interfaces will be stored in every
items in Lang. Currently only implements modules.

Locations are initially empty and filled while compiling. The loader
doesn't fill what it can yet.

Co-authored-by: Guillaume Petiot <guillaume@tarides.com>
This module significantly slows down adding a field to type decl.
Locations are added to Lang similarly to modules.
Lookup_def is moved into a separate library to apply cppo.
The source code is intended to be used by the generator but the
generator might be run from a context where the source code is gone.

As an optimisation, looking up of locations is disabled when the source
code is not given. Locations are only intended to be used to generate links
to the source code.
This has the nice side effect of removing the warning complaining that
it didn't find a .cmt file, which would have to be disabled otherwise.
Signed-off-by: Paul-Elliot <peada@free.fr>
Moreover we changed location types:
- they were relying on compiler-libs
- they were including too much

Signed-off-by: Paul-Elliot <peada@free.fr>
Added CSS, improved title, shortening code

Signed-off-by: Paul-Elliot <peada@free.fr>
Co-authored-by: Jules Aguillon <jules@j3s.fr>
Remove the secondary entry point in the generators for source code.
Also, define a URL for source code.

An alternative of this would be to represent the source code inside the
document directly. The code pages would be defined by the 'document'
library and the generators wouldn't need an extra entry point either.

Formatting promoted to tests and small refactoring.

Co-authored-by: Paul-Elliot <peada@free.fr>
Julow and others added 6 commits November 17, 2022 17:37
Introduce a new type in the document, "Document", on top of "Page" that
also allow to represent source pages. A new kind of url is needed for
source pages, it might be useful later to represent link to source pages
too.

The HTML generator no longer need to create these urls.

Co-authored-by: Paul-Elliot <peada@free.fr>
Lines anchor use the id "L<n>" where n is the line number

Signed-off-by: Paul-Elliot <peada@free.fr>
Co-authored-by: Jules Aguillon <jules@j3s.fr>
Signed-off-by: Paul-Elliot <peada@free.fr>
Signed-off-by: Paul-Elliot <peada@free.fr>
Which, is not working at the moment. The source files are discarded at
the same time as the hidden compilation units, after expansion.

Also, update Lang_desc and move source code related tests under a single
directory.
Compilation unit of hidden modules are discarded just after the link
step and the source code contained in them is lost.

After linking, do a pass on the result to find modules aliases that have
been expanded. Pair the source code of each discarded compilation unit
with the new canonical identifier created during linking.

The new identifier is used to generate the URL to the source code. For
example, the source code for the module "Main__A" which is aliased to
"A" in the module "Main" is placed in:

    Main/A/A.ml.html
@Julow
Copy link
Collaborator

Julow commented Nov 28, 2022

I've re-opened this PR from a branch hosted on the main repository, to ease collaboration.

@Julow Julow closed this Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants