1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use sway_types::{Ident, Span};
use crate::{declaration_engine::DeclarationId, transform, type_system::*};
#[derive(Clone, Debug)]
pub struct TyAbiDeclaration {
pub name: Ident,
pub interface_surface: Vec<DeclarationId>,
pub methods: Vec<DeclarationId>,
pub span: Span,
pub attributes: transform::AttributesMap,
}
impl EqWithTypeEngine for TyAbiDeclaration {}
impl PartialEqWithTypeEngine for TyAbiDeclaration {
fn eq(&self, rhs: &Self, type_engine: &TypeEngine) -> bool {
self.name == rhs.name
&& self.interface_surface.eq(&rhs.interface_surface, type_engine)
&& self.methods.eq(&rhs.methods, type_engine)
&& self.attributes == rhs.attributes
}
}
impl CreateTypeId for TyAbiDeclaration {
fn create_type_id(&self, type_engine: &TypeEngine) -> TypeId {
let ty = TypeInfo::ContractCaller {
abi_name: AbiName::Known(self.name.clone().into()),
address: None,
};
type_engine.insert_type(ty)
}
}