Stream: git-cranelift

Topic: cranelift / Issue #1357 Show existing entries in Switch


view this post on Zulip GitHub (Jan 19 2020 at 19:45):

jyn514 opened Issue #1357:

I would like Switch to have a new method entries() added which returns an immutable list of the existing entries.

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).

fn entries(&self) -> &HashMap<EntryIndex, Ebb> {
    &self.cases
}

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.

view this post on Zulip GitHub (Jan 21 2020 at 05:27):

jyn514 commented on Issue #1357:

Added in https://github.com/bytecodealliance/cranelift/pull/1358

view this post on Zulip GitHub (Jan 21 2020 at 05:27):

jyn514 closed Issue #1357:

I would like Switch to have a new method entries() added which returns an immutable list of the existing entries.

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).

fn entries(&self) -> &HashMap<EntryIndex, Ebb> {
    &self.cases
}

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