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.
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 add/set_macros/symbols in ManagedWriter #987
Use add/set_macros/symbols in ManagedWriter #987
Changes from all commits
abf3f13
522df62
fa2e0fb
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
In these cases, the
$ion::
prefix is not required, right, since the IVM installs the system module? This can be out of scope for this PR, but we might as well refine this at some point to be as succinct as possible.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.
Yes it's the raw writer that is determining this behavior. I'd also like to make this more succinct.
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.
It's the managed writer that needs to determine the behavior because the raw writer should not know whether something is in the macro table or not.
The
stepInEExp(SystemMacro)
method in the raw writer must always write a system e-expression using the specific text or binary syntax for a system e-exp (which is the current behavior).To get rid fo the unnecessary
$ion
prefix, the managed writer need to check whether the desired system macro is in the encoding module. If it is in the encoding module, then the managed writer can usestepInEExp(CharSequence)
orstepInEExp(Int, Boolean, Macro)
, similar to the logic instartMacro
(see below). If the system macro is not in the encoding module, then the managed writer needs to callstepInEExp(SystemMacro)
(which results in the qualified invocation in text or theEF
opcode in binary).ion-java/src/main/java/com/amazon/ion/impl/bin/IonManagedWriter_1_1.kt
Lines 845 to 853 in 576e018
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.
It would be nice if we could have it write it like this instead, but we can leave that for another day.
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.
I looked into that briefly- in some cases it is being written that way, so it looks like there's some more thought needed on the tuning or something else I missed.