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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use crate::{
declaration_engine::{DeclMapping, DeclarationEngine, ReplaceDecls},
engine_threading::*,
language::ty::*,
type_system::*,
types::DeterministicallyAborts,
};
#[derive(Clone, Debug)]
pub struct TyCodeBlock {
pub contents: Vec<TyAstNode>,
}
impl EqWithEngines for TyCodeBlock {}
impl PartialEqWithEngines for TyCodeBlock {
fn eq(&self, other: &Self, engines: Engines<'_>) -> bool {
self.contents.eq(&other.contents, engines)
}
}
impl CopyTypes for TyCodeBlock {
fn copy_types_inner(&mut self, type_mapping: &TypeMapping, engines: Engines<'_>) {
self.contents
.iter_mut()
.for_each(|x| x.copy_types(type_mapping, engines));
}
}
impl ReplaceSelfType for TyCodeBlock {
fn replace_self_type(&mut self, engines: Engines<'_>, self_type: TypeId) {
self.contents
.iter_mut()
.for_each(|x| x.replace_self_type(engines, self_type));
}
}
impl ReplaceDecls for TyCodeBlock {
fn replace_decls_inner(&mut self, decl_mapping: &DeclMapping, engines: Engines<'_>) {
self.contents
.iter_mut()
.for_each(|x| x.replace_decls(decl_mapping, engines));
}
}
impl DeterministicallyAborts for TyCodeBlock {
fn deterministically_aborts(
&self,
declaration_engine: &DeclarationEngine,
check_call_body: bool,
) -> bool {
self.contents
.iter()
.any(|x| x.deterministically_aborts(declaration_engine, check_call_body))
}
}