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
use sway_types::{Ident, Span};
use crate::{language::ty::*, type_system::*};
#[derive(Clone, Debug, Eq)]
pub struct TyVariableDeclaration {
pub name: Ident,
pub body: TyExpression,
pub mutability: VariableMutability,
pub type_ascription: TypeId,
pub type_ascription_span: Option<Span>,
}
impl PartialEq for TyVariableDeclaration {
fn eq(&self, other: &Self) -> bool {
self.name == other.name
&& self.body == other.body
&& self.mutability == other.mutability
&& look_up_type_id(self.type_ascription) == look_up_type_id(other.type_ascription)
}
}
impl CopyTypes for TyVariableDeclaration {
fn copy_types_inner(&mut self, type_mapping: &TypeMapping) {
self.type_ascription.copy_types(type_mapping);
self.body.copy_types(type_mapping)
}
}