-
Notifications
You must be signed in to change notification settings - Fork 110
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
Implements encoding directive macros and comment macro #973
Implements encoding directive macros and comment macro #973
Conversation
// Technically not system macros, but special forms. However, it's easier to model them as if they are macros in TDL. | ||
// We give them an ID of -1 to distinguish that they are not addressable outside TDL. | ||
IfNone(-1, "if_none", listOf(zeroToManyTagged("stream"), zeroToManyTagged("true_branch"), zeroToManyTagged("false_branch"))), | ||
IfSome(-1, "if_some", listOf(zeroToManyTagged("stream"), zeroToManyTagged("true_branch"), zeroToManyTagged("false_branch"))), | ||
IfSingle(-1, "if_single", listOf(zeroToManyTagged("stream"), zeroToManyTagged("true_branch"), zeroToManyTagged("false_branch"))), | ||
IfMulti(-1, "if_multi", listOf(zeroToManyTagged("stream"), zeroToManyTagged("true_branch"), zeroToManyTagged("false_branch"))), |
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.
🗺️ These were moved to the beginning of the enum because use
needs to reference if_none
, and the constructor args for an enum entry can only use back references to other entries of the same enum.
override fun <T : Any?> asFacet(facetType: Class<T>?): Nothing = TODO("Not supported") | ||
override fun <T : Any?> asFacet(facetType: Class<T>?): Nothing? = null | ||
override fun getDepth(): Int = containerStack.size() | ||
override fun getSymbolTable(): SymbolTable = TODO("Not implemented in this abstraction") | ||
override fun getSymbolTable(): SymbolTable? = null |
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.
🗺️ Rather than throwing exceptions, these now return null
, which is allowed by the interface. I don't know why I didn't do that to begin with, but now it means we can use e.g. _Private_IonSystem.iterate()
on a MacroEvaluatorAsIonReader
instance.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## ion-11-encoding #973 +/- ##
==================================================
Coverage ? 70.42%
Complexity ? 7049
==================================================
Files ? 201
Lines ? 27778
Branches ? 4998
==================================================
Hits ? 19562
Misses ? 6646
Partials ? 1570 ☔ View full report in Codecov by Sentry. |
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.
Could you add a TODO somewhere to add tests that verify that the encoding directive-related macros actually take effect in the readers?
symbol(IMPORT) | ||
symbol(theModule) | ||
variable(0) | ||
macro(IfNone) { |
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 think we're adding default
, so we could use it here once we implement it.
The tests in |
Issue #, if available:
None
Description of changes:
body
field toSystemMacro
use
,set_macros
, add_macros,
set_symbols,
add_symbols, and
comment`.MacroEvaluator
to support reading template bodies for system macros.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.