struct LoweringContext<'a> {Show 29 fields
function_name: String,
is_safe: bool,
param_index_map: HashMap<String, usize>,
param_types: &'a [ValueType],
return_slots: Vec<Option<usize>>,
return_types: Vec<ValueType>,
state_variables: &'a [StateVariableMetadata],
state_index_map: &'a HashMap<String, usize>,
state_types: &'a [ValueType],
defined_struct_types: &'a [ValueType],
event_index_map: &'a HashMap<String, usize>,
event_signature_map: &'a HashMap<String, Vec<ManifestType>>,
enum_variant_map: &'a HashMap<String, HashMap<String, u64>>,
contract_types: &'a HashSet<String>,
selector_registry: &'a SelectorRegistry,
function_names: &'a HashSet<String>,
function_overloads: &'a HashMap<(String, usize), String>,
function_param_names: &'a HashMap<(String, usize), Vec<String>>,
void_functions: &'a HashSet<String>,
super_method_map: &'a HashMap<String, String>,
local_index_map: HashMap<String, Vec<usize>>,
local_types: HashMap<usize, ValueType>,
scope_stack: Vec<Vec<String>>,
storage_aliases: HashMap<String, StorageReference>,
call_data_locals: HashMap<usize, String>,
local_count: u16,
label_counter: usize,
loop_stack: Vec<LoopLabels>,
errors: Vec<IrDiagnostic>,
}Fields§
§function_name: String§is_safe: bool§param_index_map: HashMap<String, usize>§param_types: &'a [ValueType]§return_slots: Vec<Option<usize>>§return_types: Vec<ValueType>§state_variables: &'a [StateVariableMetadata]§state_index_map: &'a HashMap<String, usize>§state_types: &'a [ValueType]§defined_struct_types: &'a [ValueType]Canonical struct type definitions available to the compilation unit.
This enables resolving user-defined structs even when they are only used in local variables (i.e., not present in state/param/return types).
event_index_map: &'a HashMap<String, usize>§event_signature_map: &'a HashMap<String, Vec<ManifestType>>§enum_variant_map: &'a HashMap<String, HashMap<String, u64>>§contract_types: &'a HashSet<String>§selector_registry: &'a SelectorRegistry§function_names: &'a HashSet<String>§function_overloads: &'a HashMap<(String, usize), String>§function_param_names: &'a HashMap<(String, usize), Vec<String>>Ordered parameter names for each function overload, keyed by (name, arg_count). Used to reorder named function call arguments into positional order.
void_functions: &'a HashSet<String>Functions that return void (empty return_parameters). Used to avoid emitting DROP after calling a void internal function as a statement.
super_method_map: &'a HashMap<String, String>Mapping from original method name to renamed super-method name.
Used to resolve super.method() calls during IR lowering.
local_index_map: HashMap<String, Vec<usize>>§local_types: HashMap<usize, ValueType>§scope_stack: Vec<Vec<String>>§storage_aliases: HashMap<String, StorageReference>§call_data_locals: HashMap<usize, String>§local_count: u16§label_counter: usize§loop_stack: Vec<LoopLabels>§errors: Vec<IrDiagnostic>Implementations§
Source§impl<'a> LoweringContext<'a>
impl<'a> LoweringContext<'a>
fn new( function_name: &str, is_safe: bool, param_index_map: HashMap<String, usize>, param_types: &'a [ValueType], state_variables: &'a [StateVariableMetadata], state_index_map: &'a HashMap<String, usize>, state_types: &'a [ValueType], defined_struct_types: &'a [ValueType], event_index_map: &'a HashMap<String, usize>, event_signature_map: &'a HashMap<String, Vec<ManifestType>>, enum_variant_map: &'a HashMap<String, HashMap<String, u64>>, contract_types: &'a HashSet<String>, selector_registry: &'a SelectorRegistry, function_names: &'a HashSet<String>, function_overloads: &'a HashMap<(String, usize), String>, function_param_names: &'a HashMap<(String, usize), Vec<String>>, void_functions: &'a HashSet<String>, super_method_map: &'a HashMap<String, String>, ) -> Self
fn set_return_info(&mut self, slots: Vec<Option<usize>>, types: Vec<ValueType>)
fn return_slots(&self) -> &[Option<usize>]
fn return_types(&self) -> &[ValueType]
fn next_label(&mut self) -> usize
fn push_loop(&mut self, continue_label: usize, break_label: usize)
fn pop_loop(&mut self)
fn break_target(&self) -> Option<usize>
fn continue_target(&self) -> Option<usize>
fn record_error(&mut self, message: impl Into<String>)
fn record_error_with_suggestion( &mut self, message: impl Into<String>, suggestion: impl Into<String>, )
fn set_call_data_local(&mut self, local_index: usize, method: String)
fn clear_call_data_local(&mut self, local_index: usize)
fn call_data_method_for_local(&self, local_index: usize) -> Option<&str>
fn is_contract_type_name(&self, name: &str) -> bool
fn type_method_selectors( &self, type_name: &str, method_name: &str, ) -> Option<&Vec<[u8; 4]>>
fn is_interface_type_name(&self, name: &str) -> bool
fn interface_id_for_type(&self, type_name: &str) -> Option<[u8; 4]>
fn state_type(&self, index: usize) -> Option<&ValueType>
fn state_metadata(&self, index: usize) -> Option<&StateVariableMetadata>
fn can_write_state(&self, state_index: usize) -> bool
fn ensure_state_writable(&mut self, state_index: usize) -> bool
fn parameter_type(&self, name: &str) -> Option<&ValueType>
fn local_type(&self, index: usize) -> Option<&ValueType>
fn variable_type(&self, name: &str) -> Option<ValueType>
fn neo_function_name(&self, name: &str, arg_count: usize) -> Option<String>
Sourcefn get_function_param_names(
&self,
name: &str,
arg_count: usize,
) -> Option<&[String]>
fn get_function_param_names( &self, name: &str, arg_count: usize, ) -> Option<&[String]>
Returns the ordered parameter names for a function overload, if known.
Sourcefn is_void_function(&self, name: &str) -> bool
fn is_void_function(&self, name: &str) -> bool
Returns true if the named function returns void (no return values).
Sourcefn super_method_name(&self, method_name: &str) -> Option<&str>
fn super_method_name(&self, method_name: &str) -> Option<&str>
Returns the renamed super-method name for super.method() resolution.
fn event_signature(&self, event_name: &str) -> Option<&[ManifestType]>
fn allocate_local( &mut self, name: String, value_type: Option<ValueType>, ) -> usize
fn resolve_local(&self, name: &str) -> Option<usize>
fn ensure_local(&mut self, name: &str) -> usize
fn enter_scope(&mut self)
fn exit_scope(&mut self)
fn is_local_in_current_scope(&self, name: &str) -> bool
fn set_storage_alias(&mut self, name: String, alias: StorageReference)
fn storage_alias(&self, name: &str) -> Option<&StorageReference>
Auto Trait Implementations§
impl<'a> Freeze for LoweringContext<'a>
impl<'a> RefUnwindSafe for LoweringContext<'a>
impl<'a> Send for LoweringContext<'a>
impl<'a> Sync for LoweringContext<'a>
impl<'a> Unpin for LoweringContext<'a>
impl<'a> UnwindSafe for LoweringContext<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more