@@ -37,7 +37,7 @@ impl Node for FuncDefNode {
3737 format_res. push_str ( & doc_str) ;
3838 format_res. push_str ( & prefix. repeat ( tabs) ) ;
3939 format_res. push_str ( "fn " ) ;
40- format_res. push_str ( & self . typenode . id . split ( "::" ) . last ( ) . unwrap ( ) ) ;
40+ format_res. push_str ( & self . typenode . id . name . split ( "::" ) . last ( ) . unwrap ( ) ) ;
4141 format_res. push_str ( "(" ) ;
4242 format_res. push_str ( & params_print) ;
4343 format_res. push_str ( ") " ) ;
@@ -62,7 +62,7 @@ impl Node for FuncDefNode {
6262 tab ( tabs, line. clone ( ) , end) ;
6363 println ! ( "FuncDefNode" ) ;
6464 tab ( tabs + 1 , line. clone ( ) , false ) ;
65- println ! ( "id: {}" , self . typenode. id) ;
65+ println ! ( "id: {}" , self . typenode. id. name ) ;
6666 for c in self . typenode . doc . iter ( ) {
6767 c. print ( tabs + 1 , false , line. clone ( ) ) ;
6868 }
@@ -83,7 +83,7 @@ impl Node for FuncDefNode {
8383 let mut para_pltypes = Vec :: new ( ) ;
8484 let mut para_names = Vec :: new ( ) ;
8585 let mut param_ditypes = Vec :: new ( ) ;
86- ctx. push_semantic_token ( self . typenode . range , SemanticTokenType :: FUNCTION , 0 ) ;
86+ ctx. push_semantic_token ( self . typenode . id . range , SemanticTokenType :: FUNCTION , 0 ) ;
8787 for para in self . typenode . paralist . iter ( ) {
8888 ctx. push_semantic_token ( para. id . range , SemanticTokenType :: PARAMETER , 0 ) ;
8989 ctx. push_semantic_token ( para. tp . range ( ) , SemanticTokenType :: TYPE , 0 ) ;
@@ -105,7 +105,7 @@ impl Node for FuncDefNode {
105105 }
106106 }
107107 ctx. push_semantic_token ( self . typenode . ret . range ( ) , SemanticTokenType :: TYPE , 0 ) ;
108- let res = ctx. get_type ( self . typenode . id . as_str ( ) , self . range ) ;
108+ let res = ctx. get_type ( self . typenode . id . name . as_str ( ) , self . range ) ;
109109 if res. is_err ( ) {
110110 let diag = res. unwrap_err ( ) ;
111111 ctx. add_diag ( diag. clone ( ) ) ;
@@ -121,7 +121,7 @@ impl Node for FuncDefNode {
121121 ) ;
122122 let subprogram = ctx. dibuilder . create_function (
123123 ctx. diunit . get_file ( ) . as_debug_info_scope ( ) ,
124- self . typenode . id . as_str ( ) ,
124+ self . typenode . id . name . as_str ( ) ,
125125 None ,
126126 ctx. diunit . get_file ( ) ,
127127 self . range . start . line as u32 ,
@@ -220,7 +220,7 @@ impl Node for FuncDefNode {
220220 }
221221 // emit body
222222 ctx. builder . unset_current_debug_location ( ) ;
223- if self . typenode . id == "main" {
223+ if self . typenode . id . name == "main" {
224224 if let Some ( inst) = allocab. get_first_instruction ( ) {
225225 ctx. builder . position_at ( allocab, & inst) ;
226226 ctx. nodebug_builder . position_at ( allocab, & inst) ;
@@ -347,7 +347,7 @@ impl Node for FuncCallNode {
347347#[ range]
348348#[ derive( Clone , PartialEq , Eq , Debug ) ]
349349pub struct FuncTypeNode {
350- pub id : String ,
350+ pub id : Box < VarNode > ,
351351 pub paralist : Vec < Box < TypedIdentifierNode > > ,
352352 pub ret : Box < TypeNodeEnum > ,
353353 pub doc : Vec < Box < NodeEnum > > ,
@@ -358,7 +358,7 @@ impl FuncTypeNode {
358358 & ' a mut self ,
359359 ctx : & mut crate :: ast:: ctx:: Ctx < ' a , ' ctx > ,
360360 ) -> Result < FunctionValue < ' ctx > , PLDiag > {
361- if let Ok ( _) = ctx. get_type ( self . id . as_str ( ) , self . range ) {
361+ if let Ok ( _) = ctx. get_type ( & self . id . name . as_str ( ) , self . range ) {
362362 return Err ( ctx. add_err ( self . range , ErrorCode :: REDEFINE_SYMBOL ) ) ;
363363 }
364364 let mut param_pltypes = Vec :: new ( ) ;
@@ -386,32 +386,33 @@ impl FuncTypeNode {
386386 }
387387 let refs = vec ! [ ] ;
388388 let ftp = FNType {
389- name : self . id . clone ( ) ,
389+ name : self . id . name . clone ( ) ,
390390 ret_pltype : Box :: new ( self . ret . get_type ( ctx) ?) ,
391391 param_pltypes,
392392 param_name,
393393 range : self . range ,
394394 refs : Rc :: new ( RefCell :: new ( refs) ) ,
395395 doc : self . doc . clone ( ) ,
396396 llvmname : if self . declare {
397- self . id . clone ( )
397+ self . id . name . clone ( )
398398 } else {
399- ctx. plmod . get_full_name ( & self . id )
399+ ctx. plmod . get_full_name ( & self . id . name )
400400 } ,
401401 method : receiver. is_some ( ) ,
402402 } ;
403403 if let Some ( mut receiver) = receiver {
404- receiver
405- . methods
406- . insert ( self . id . split ( "::" ) . last ( ) . unwrap ( ) . to_string ( ) , ftp. clone ( ) ) ;
404+ receiver. methods . insert (
405+ self . id . name . split ( "::" ) . last ( ) . unwrap ( ) . to_string ( ) ,
406+ ftp. clone ( ) ,
407+ ) ;
407408 receivertp
408409 . unwrap ( )
409410 . replace_type ( ctx, PLType :: STRUCT ( receiver) ) ;
410411 }
411412 let res = ftp. get_or_insert_fn ( ctx) ;
412413 let pltype = PLType :: FN ( ftp) ;
413414 ctx. set_if_refs_tp ( & pltype, self . range ) ;
414- ctx. add_type ( self . id . clone ( ) , pltype. clone ( ) , self . range ) ?;
415+ ctx. add_type ( self . id . name . clone ( ) , pltype. clone ( ) , self . range ) ?;
415416 ctx. add_doc_symbols ( pltype) ;
416417 Ok ( res)
417418 }
0 commit comments