-
Notifications
You must be signed in to change notification settings - Fork 102
Re-implement standalone_run_as_ppx_rewriter #197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pitag-ha
merged 1 commit into
ocaml-ppx:master
from
pitag-ha:standalone-run-as-ppx-rewriter
Dec 28, 2020
Merged
Re-implement standalone_run_as_ppx_rewriter #197
pitag-ha
merged 1 commit into
ocaml-ppx:master
from
pitag-ha:standalone-run-as-ppx-rewriter
Dec 28, 2020
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dc9c3fc to
96d33da
Compare
Member
Author
|
The ocaml-ci is green apart from the old compiler version and the arm32 jobs. Those failures aren't related to this PR. |
NathanReb
reviewed
Dec 18, 2020
Collaborator
NathanReb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for the great cram tests!
71bc811 to
e2c2008
Compare
e2c2008 to
a1d441d
Compare
Before, the standalone_run_as_ppx_rewriter implementation was based on compiler-lib's Ast_mapper. With this commit, it reuses the adequate parts of the internal implementation of the main standalone. That has two advantages: - it takes away a burden for Astlib - it makes it possible to access the source file name from within the driver module This commit also fixes the following: now, standalone_run_as_ppx_rewriter takes into account the `loc-filename` argument when provided. Since that argument forms part of `shared_args`, that's the expected behaviour. Signed-off-by: Sonja Heinze <[email protected]>
NathanReb
added a commit
to NathanReb/opam-repository
that referenced
this pull request
Jan 20, 2021
CHANGES: - Driver (important for bucklescript): handling binary AST's, accept any supported version as input; preserve that version (ocaml-ppx/ppxlib#205, @pitag-ha) - `-as-ppx`: take into account the `-loc-filename` argument (ocaml-ppx/ppxlib#197, @pitag-ha) - Add input name to expansion context (ocaml-ppx/ppxlib#202, @pitag-ha) - Add Driver.V2: give access to expansion context in whole file transformation callbacks of `register_transformation` (ocaml-ppx/ppxlib#202, @pitag-ha) - Driver: take `-cookie` argument into account, also when the input is a binary AST (@pitag-ha, ocaml-ppx/ppxlib#209) - `run_as_ppx_rewriter`: take into account the arguments `-loc-filename`, `apply` and `dont-apply` (ocaml-ppx/ppxlib#205, @pitag-ha) - Location.Error: add functions `raise` and `update_loc` (ocaml-ppx/ppxlib#205, @pitag-ha)
NathanReb
added a commit
to NathanReb/opam-repository
that referenced
this pull request
Jan 22, 2021
CHANGES: - Fix ppxlib.traverse declaration and make it a deriver and not a rewriter (ocaml-ppx/ppxlib#213, @NathanReb) - Driver (important for bucklescript): handling binary AST's, accept any supported version as input; preserve that version (ocaml-ppx/ppxlib#205, @pitag-ha) - `-as-ppx`: take into account the `-loc-filename` argument (ocaml-ppx/ppxlib#197, @pitag-ha) - Add input name to expansion context (ocaml-ppx/ppxlib#202, @pitag-ha) - Add Driver.V2: give access to expansion context in whole file transformation callbacks of `register_transformation` (ocaml-ppx/ppxlib#202, @pitag-ha) - Driver: take `-cookie` argument into account, also when the input is a binary AST (@pitag-ha, ocaml-ppx/ppxlib#209) - `run_as_ppx_rewriter`: take into account the arguments `-loc-filename`, `apply` and `dont-apply` (ocaml-ppx/ppxlib#205, @pitag-ha) - Location.Error: add functions `raise` and `update_loc` (ocaml-ppx/ppxlib#205, @pitag-ha)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before, the
standalone_run_as_ppx_rewriterimplementation was based on compiler-lib's Ast_mapper. With this commit, it reuses the adequate parts of the internal implementation of the main standalone. That has three advantages:This commit also fixes the following: now,
standalone_run_as_ppx_rewritertakes into account theloc-filenameargument when provided. Since that argument forms part ofshared_args, that's the expected behaviour.When comparing the new implementation with the old one, note that in the new one the ppx context gets restored through
extract_cookiesand the cookies get updated throughIntf_or_impl.to_ast_iowith~add_ppx_context:true.