From 9bdabd5be142a5b0da10ca22a700d2b5acb537b2 Mon Sep 17 00:00:00 2001 From: shruti2522 Date: Sun, 2 Jun 2024 05:49:36 +0530 Subject: [PATCH] update walk_call_expr for namer Signed-off-by: shruti2522 --- kclvm/sema/src/namer/node.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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 {