diff --git a/kclvm/sema/src/namer/node.rs b/kclvm/sema/src/namer/node.rs index ab923cef7..469535b4a 100644 --- a/kclvm/sema/src/namer/node.rs +++ b/kclvm/sema/src/namer/node.rs @@ -1,6 +1,7 @@ use crate::core::package::ImportInfo; use crate::core::symbol::{ - AttributeSymbol, RuleSymbol, SchemaSymbol, SymbolKind, SymbolRef, TypeAliasSymbol, ValueSymbol, + AttributeSymbol, FunctionSymbol, RuleSymbol, SchemaSymbol, SymbolKind, SymbolRef, + TypeAliasSymbol, ValueSymbol, }; use super::Namer; @@ -255,8 +256,15 @@ impl<'ctx> MutSelfTypedResultWalker<'ctx> for Namer<'ctx> { None } - fn walk_call_expr(&mut self, _call_expr: &'ctx ast::CallExpr) -> Self::Result { - None + fn walk_call_expr(&mut self, call_expr: &'ctx ast::CallExpr) -> Self::Result { + let (start_pos, end_pos): Range = call_expr.func.get_span_pos(); + let owner = self.ctx.owner_symbols.last().unwrap().clone(); + let func_name = call_expr.func.node.get_expr_name(); + let func_ref = self.gs.get_symbols_mut().alloc_function_symbol( + FunctionSymbol::new(func_name, start_pos, end_pos, Some(owner), true), + self.ctx.get_node_key(&call_expr.func.id), + ); + Some(vec![func_ref]) } fn walk_subscript(&mut self, _subscript: &'ctx ast::Subscript) -> Self::Result {