jyn514 opened Issue #1357:
- What is the feature or code improvement you would like to do in Cranelift?
I would like
Switch
to have a new methodentries()
added which returns an immutable list of the existing entries.
- What is the value of adding this in Cranelift?
This would allow me to check in the codegen module whether a
case
expression has already been added, instead of having to frontload it in the parser (which for various reasons would be possible but annoying).
- Do you have an implementation plan, and/or ideas for data structures or
algorithms to use?fn entries(&self) -> &HashMap<EntryIndex, Ebb> { &self.cases }
- Have you considered alternative implementations? If so, how are they better
or worse than your proposal?Alternatively, Cranelift could
impl Deref<Target = HashMap<...>>
for Switch. This would also provide more methods at the same time.Cranelift could also choose to do nothing at all.
jyn514 commented on Issue #1357:
Added in https://github.com/bytecodealliance/cranelift/pull/1358
jyn514 closed Issue #1357:
- What is the feature or code improvement you would like to do in Cranelift?
I would like
Switch
to have a new methodentries()
added which returns an immutable list of the existing entries.
- What is the value of adding this in Cranelift?
This would allow me to check in the codegen module whether a
case
expression has already been added, instead of having to frontload it in the parser (which for various reasons would be possible but annoying).
- Do you have an implementation plan, and/or ideas for data structures or
algorithms to use?fn entries(&self) -> &HashMap<EntryIndex, Ebb> { &self.cases }
- Have you considered alternative implementations? If so, how are they better
or worse than your proposal?Alternatively, Cranelift could
impl Deref<Target = HashMap<...>>
for Switch. This would also provide more methods at the same time.Cranelift could also choose to do nothing at all.
Last updated: Dec 23 2024 at 13:07 UTC