@@ -6,7 +6,7 @@ use ruff_index::{newtype_index, IndexVec};
6
6
pub ( crate ) struct TypeId ;
7
7
8
8
impl TypeId {
9
- pub ( crate ) fn typ ( self , env : & TypeEnvironment ) -> & Type {
9
+ pub ( crate ) fn ty ( self , env : & TypeEnvironment ) -> & Type {
10
10
env. type_for_id ( self )
11
11
}
12
12
}
@@ -19,14 +19,14 @@ pub(crate) struct TypeEnvironment {
19
19
20
20
impl TypeEnvironment {
21
21
pub ( crate ) fn add_class ( & mut self , name : & str ) -> TypeId {
22
- let class = Type :: Class ( TypeClass {
22
+ let class = Type :: Class ( ClassType {
23
23
name : Name :: new ( name) ,
24
24
} ) ;
25
25
self . types_by_id . push ( class)
26
26
}
27
27
28
28
pub ( crate ) fn add_function ( & mut self , name : & str ) -> TypeId {
29
- let function = Type :: Function ( TypeFunction {
29
+ let function = Type :: Function ( FunctionType {
30
30
name : Name :: new ( name) ,
31
31
} ) ;
32
32
self . types_by_id . push ( function)
@@ -38,8 +38,8 @@ impl TypeEnvironment {
38
38
}
39
39
40
40
pub ( crate ) enum Type {
41
- Class ( TypeClass ) ,
42
- Function ( TypeFunction ) ,
41
+ Class ( ClassType ) ,
42
+ Function ( FunctionType ) ,
43
43
}
44
44
45
45
impl Type {
@@ -51,21 +51,21 @@ impl Type {
51
51
}
52
52
}
53
53
54
- pub ( crate ) struct TypeClass {
54
+ pub ( crate ) struct ClassType {
55
55
name : Name ,
56
56
}
57
57
58
- impl TypeClass {
58
+ impl ClassType {
59
59
pub ( crate ) fn name ( & self ) -> & str {
60
60
self . name . as_str ( )
61
61
}
62
62
}
63
63
64
- pub ( crate ) struct TypeFunction {
64
+ pub ( crate ) struct FunctionType {
65
65
name : Name ,
66
66
}
67
67
68
- impl TypeFunction {
68
+ impl FunctionType {
69
69
pub ( crate ) fn name ( & self ) -> & str {
70
70
self . name . as_str ( )
71
71
}
@@ -79,13 +79,13 @@ mod tests {
79
79
fn add_class ( ) {
80
80
let mut env = TypeEnvironment :: default ( ) ;
81
81
let cid = env. add_class ( "C" ) ;
82
- assert_eq ! ( cid. typ ( & env) . name( ) , "C" ) ;
82
+ assert_eq ! ( cid. ty ( & env) . name( ) , "C" ) ;
83
83
}
84
84
85
85
#[ test]
86
86
fn add_function ( ) {
87
87
let mut env = TypeEnvironment :: default ( ) ;
88
88
let fid = env. add_function ( "func" ) ;
89
- assert_eq ! ( fid. typ ( & env) . name( ) , "func" ) ;
89
+ assert_eq ! ( fid. ty ( & env) . name( ) , "func" ) ;
90
90
}
91
91
}
0 commit comments