#[derive(Debug, Clone, Default)]
pub struct NatspecDocIR {
pub title: Option<String>,
pub author: Option<String>,
pub notice: Option<String>,
pub dev: Option<String>,
pub params: Vec<(String, String)>,
pub returns: Vec<String>,
pub custom: Vec<(String, String)>,
}
#[derive(Debug, Clone)]
pub struct ContractIR {
pub name: String,
pub kind: ContractKind,
pub bases: Vec<Base>,
pub functions: Vec<FunctionIR>,
pub events: Vec<EventIR>,
pub errors: Vec<ErrorIR>,
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 using_directives: Vec<UsingDirectiveIR>,
pub has_type_definitions: bool,
pub type_aliases: std::collections::HashMap<String, String>,
pub super_method_map: std::collections::HashMap<String, String>,
}
#[derive(Debug, Clone)]
pub struct UsingDirectiveIR {
pub target_type: Option<String>,
pub function_names: Option<Vec<String>>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ContractKind {
Contract,
AbstractContract,
Interface,
Library,
}
#[derive(Debug, Clone)]
pub struct FunctionIR {
pub name: String,
pub ty: FunctionTy,
pub parameters: Vec<ParameterIR>,
pub returns: Vec<ParameterIR>,
pub mutability: MutabilityKind,
pub visibility: VisibilityKind,
pub is_virtual: bool,
pub is_override: bool,
pub base_or_modifiers: Vec<Base>,
pub body: Option<Statement>,
pub doc: NatspecDocIR,
pub had_modifier_epilogue: bool,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MutabilityKind {
Pure,
View,
Payable,
NonPayable,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum VisibilityKind {
External,
Public,
Internal,
Private,
}
#[derive(Debug, Clone)]
pub struct ParameterIR {
pub name: Option<String>,
pub ty: String,
pub storage: Option<String>,
}
#[derive(Debug, Clone)]
pub struct EventIR {
pub name: String,
pub parameters: Vec<EventParameterIR>,
pub anonymous: bool,
}
#[derive(Debug, Clone)]
pub struct EventParameterIR {
pub name: Option<String>,
pub ty: String,
pub indexed: bool,
}
#[derive(Debug, Clone)]
pub struct ErrorIR {
pub name: String,
pub parameters: Vec<ParameterIR>,
}
#[derive(Debug, Clone)]
pub struct StateVariableIR {
pub name: Option<String>,
pub ty: String,
pub is_constant: bool,
pub is_immutable: bool,
pub visibility: Option<String>,
pub has_initializer: bool,
pub initializer: Option<Expression>,
}
#[derive(Debug, Clone)]
pub struct StructIR {
pub name: String,
pub fields: Vec<StructFieldIR>,
}
#[derive(Debug, Clone)]
pub struct StructFieldIR {
pub name: String,
pub ty: String,
}
#[derive(Debug, Clone)]
pub struct EnumIR {
pub name: String,
pub values: Vec<String>,
}