@@ -6,26 +6,28 @@ use bytecode::compilation_bridge::id::{MAKE_FUNCTION, RET};
66use crate :: {
77 ast:: {
88 function:: FunctionType , Block , CompilationState , Compile , CompiledFunctionId , CompiledItem ,
9- Dependencies , FunctionParameters , Ident , TypeLayout , WalkForType ,
9+ Dependencies , Dependency , FunctionParameters , Ident , TypeLayout , WalkForType ,
1010 } ,
1111 instruction,
1212 parser:: { Node , Parser , Rule } ,
1313 scope:: ScopeReturnStatus ,
1414 BytecodePathStr , VecErr ,
1515} ;
1616
17+ use super :: ClassType ;
18+
1719#[ derive( Debug ) ]
1820pub ( crate ) struct MemberFunction {
1921 ident : Ident ,
2022 parameters : Rc < FunctionParameters > ,
2123 body : Block ,
2224 path_str : Arc < PathBuf > ,
23- class_name : Arc < String > ,
25+ class_type : ClassType ,
2426}
2527
2628impl MemberFunction {
2729 pub fn symbolic_id ( & self ) -> String {
28- format ! ( "{}::{}" , self . class_name , self . ident( ) . name( ) )
30+ format ! ( "{}::{}" , self . class_type . name ( ) , self . ident( ) . name( ) )
2931 }
3032}
3133
@@ -117,7 +119,14 @@ impl Dependencies for MemberFunction {
117119 }
118120
119121 fn supplies ( & self ) -> Vec < crate :: ast:: Dependency > {
120- self . parameters . supplies ( )
122+ let mut params = self . parameters . supplies ( ) ;
123+ params. push ( Dependency :: new ( Cow :: Owned ( Ident :: new (
124+ "self" . to_owned ( ) ,
125+ Some ( Cow :: Owned ( TypeLayout :: Class ( self . class_type . clone ( ) ) ) ) ,
126+ false ,
127+ ) ) ) ) ;
128+
129+ params
121130 }
122131}
123132
@@ -162,7 +171,7 @@ impl Parser {
162171 parameters,
163172 path_str : input. user_data ( ) . bytecode_path ( ) ,
164173 body,
165- class_name : class_type. arced_name ( ) ,
174+ class_type,
166175 } )
167176 }
168177}
0 commit comments