-
Notifications
You must be signed in to change notification settings - Fork 5
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
Use Shopify/rbs
's latest C parser implementation
#426
base: master
Are you sure you want to change the base?
Conversation
f021d4e
to
046e975
Compare
50ab3a7
to
e82cee7
Compare
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.
That cleans up really nicely!
rbs_constant_t *constant = rbs_constant_pool_id_to_constant(fake_constant_pool, node->name->constant_id); | ||
string_view str(constant->start, constant->length); | ||
auto str = parser.resolveConstant(node->name); |
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.
Nice.
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.
Overall looks good, I'm mostly concerned about the changes to realmain.cc
5bdbdcd
to
47e7d0d
Compare
ed2dc23
to
e6a5c3a
Compare
- Create SignatureTranslator to simplify the translation of RBS signatures - Make TypeTranslator and MethodTypeTranslator store parser state - Remove RBSParser
The global constant pool is initialized at process startup and freed at process exit. With this change, we don't need to manually manage them in realmain.cc and pipeline_test_runner.cc. Co-authored-by: Alexander Momchilov <alexander.momchilov@shopify.com>
Motivation
This PR adopts the latest RBS parser implementation from
Shopify/rbs
with a major refactor.Some key changes:
realmain
module and the beginning of the testing pipelineSignatureTranslator
now performs both RBS parsing + translation in itstranslateType
andtranslateSignature
functionsrbs::Type
andrbs::MethodType
structs become redundant as we don't need an intermediate data typeTypeTranslator
andMethodTypeTranslator
now store states like context and constant pool to reduce the number of parameters its functions need to keep passing downBefore
Unable to render rich display
Could not find a suitable point for the given distance
For more information, see https://docs.github.com/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams#creating-mermaid-diagrams
After
Unable to render rich display
Could not find a suitable point for the given distance
For more information, see https://docs.github.com/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams#creating-mermaid-diagrams
Test plan
See included automated tests.