Trait llhd::value::Context [] [src]

pub trait Context: AsContext {
    fn try_value(&self, value: &ValueRef) -> Option<&Value>;

    fn parent(&self) -> Option<&Context> { ... }
fn value(&self, value: &ValueRef) -> &Value { ... }
fn ty(&self, value: &ValueRef) -> Type { ... }
fn name(&self, value: &ValueRef) -> Option<&str> { ... } }

A context is anything that can resolve the name and type of a ValueRef. Contexts are expected to form a hierarchy, such that a context wrapping e.g. a function falls back to a parent context wrapping the module if a value cannot be appropriately resolved.

Required Methods

Try to resolve a ValueRef to an actual &Value reference. May fail if the value is not known to the context.

Provided Methods

Get the parent context to which value resolution shall escalate. May return None for the context at the top of the hierarchy.

Resolve a ValueRef to an actual &Value reference. Panics if the value is unknown to this context and its parents.

Get the type of a value.

Get the name of a value.

Implementors