ContractIR

Struct ContractIR 

Source
pub struct ContractIR {
Show 15 fields pub name: String, pub kind: ContractKind, pub bases: Vec<Base>, pub functions: Vec<FunctionIR>, pub events: Vec<EventIR>, pub state_variables: Vec<StateVariableIR>, pub structs: Vec<StructIR>, pub enums: Vec<EnumIR>, pub doc: NatspecDocIR, pub has_using_for_star: bool, pub has_using_function_list: bool, pub using_for_libraries: Vec<String>, pub has_type_definitions: bool, pub type_aliases: HashMap<String, String>, pub super_method_map: HashMap<String, String>,
}
Expand description

Representation of a Solidity contract.

Fields§

§name: String§kind: ContractKind§bases: Vec<Base>

Inheritance specifiers (contract X is A, B(...) { ... }).

§functions: Vec<FunctionIR>§events: Vec<EventIR>§state_variables: Vec<StateVariableIR>§structs: Vec<StructIR>§enums: Vec<EnumIR>§doc: NatspecDocIR

Natspec documentation for this contract

§has_using_for_star: bool

Whether this contract contains using X for Y directives.

The compiler merges library functions into the contract wholesale, so basic using LibName for Type works implicitly. This flag is set when advanced forms (using X for *, using { f, g } for Y) are present so that diagnostics can be emitted.

§has_using_function_list: bool§using_for_libraries: Vec<String>

Library names referenced by using X for Y directives.

The compiler merges all non-builtin library functions into the contract wholesale, so using LibName for Type member-call syntax (e.g. x.add(y)) resolves to LibName.add(x, y) automatically. This list is kept for diagnostic purposes.

§has_type_definitions: bool

Whether this contract contains type X is Y definitions.

§type_aliases: HashMap<String, String>

User-defined value type aliases (type X is Y).

Maps the user-defined type name to its underlying Solidity type string. During type resolution, X is transparently replaced by Y. X.wrap(v) and X.unwrap(v) compile to no-ops.

§super_method_map: HashMap<String, String>

Mapping from original method name to the renamed super-method name.

When inheritance flattening detects an override, the base version of the function is preserved as __super_{methodName} and this map records the relationship so that super.method() can be resolved during IR lowering.

Trait Implementations§

Source§

impl Clone for ContractIR

Source§

fn clone(&self) -> ContractIR

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ContractIR

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.