[−][src]Trait llhd::Context
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
fn try_value(&self, value: &ValueRef) -> Option<&dyn Value>
Try to resolve a ValueRef
to an actual &Value
reference. May fail if
the value is not known to the context.
Provided methods
fn parent(&self) -> Option<&dyn Context>
Get the parent context to which value resolution shall escalate. May
return None
for the context at the top of the hierarchy.
fn value(&self, value: &ValueRef) -> &dyn Value
Resolve a ValueRef
to an actual &Value
reference. Panics if the
value is unknown to this context and its parents.
fn ty(&self, value: &ValueRef) -> Type
Get the type of a value.
fn name(&self, value: &ValueRef) -> Option<&str>
Get the name of a value.
Implementors
impl<'tctx> Context for EntityContext<'tctx>
[src]
impl<'tctx> Context for EntityContext<'tctx>
fn parent(&self) -> Option<&dyn Context> | [src] |
fn try_value(&self, value: &ValueRef) -> Option<&dyn Value> | [src] |
fn value(&self, value: &ValueRef) -> &dyn Value | [src] |
fn ty(&self, value: &ValueRef) -> Type | [src] |
fn name(&self, value: &ValueRef) -> Option<&str> | [src] |
impl<'tctx> Context for FunctionContext<'tctx>
[src]
impl<'tctx> Context for FunctionContext<'tctx>
fn parent(&self) -> Option<&dyn Context> | [src] |
fn try_value(&self, value: &ValueRef) -> Option<&dyn Value> | [src] |
fn value(&self, value: &ValueRef) -> &dyn Value | [src] |
fn ty(&self, value: &ValueRef) -> Type | [src] |
fn name(&self, value: &ValueRef) -> Option<&str> | [src] |
impl<'tctx> Context for ModuleContext<'tctx>
[src]
impl<'tctx> Context for ModuleContext<'tctx>
fn try_value(&self, value: &ValueRef) -> Option<&dyn Value> | [src] |
fn parent(&self) -> Option<&dyn Context> | [src] |
fn value(&self, value: &ValueRef) -> &dyn Value | [src] |
fn ty(&self, value: &ValueRef) -> Type | [src] |
fn name(&self, value: &ValueRef) -> Option<&str> | [src] |
impl<'tctx> Context for ProcessContext<'tctx>
[src]
impl<'tctx> Context for ProcessContext<'tctx>