We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f26c78a commit ecb4985Copy full SHA for ecb4985
src/main/java/com/amazon/ion/impl/macro/MacroRef.kt
@@ -13,8 +13,11 @@ sealed interface MacroRef {
13
// TODO: Since system macros have an independent address space, do we need to have a `SystemById` variant?
14
15
companion object {
16
+
17
+ private val LOW_IDS = Array(128) { i -> ById(i) }
18
19
@JvmStatic
- fun byId(id: Int): MacroRef = ById(id)
20
+ fun byId(id: Int): MacroRef = if (id < 128) LOW_IDS[id] else ById(id)
21
22
23
fun byName(name: String): MacroRef = ByName(name)
0 commit comments