diff --git a/src/name.rs b/src/name.rs index ab65c25..b97e9f2 100644 --- a/src/name.rs +++ b/src/name.rs @@ -56,7 +56,7 @@ impl Display for ResolvedName { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { ResolvedName::Remote(name) => write!(f, "/{}", name), - ResolvedName::Project(name) => write!(f, "/{}", name), + ResolvedName::Project(name) => write!(f, "{}", name), } } } diff --git a/src/resolve/expr/call.rs b/src/resolve/expr/call.rs index f4a3c85..4594eb7 100644 --- a/src/resolve/expr/call.rs +++ b/src/resolve/expr/call.rs @@ -23,7 +23,18 @@ pub fn resolve_call_expr( .at(source)); } - let resolved_name = ResolvedName::Project(call.function_name.basename.clone().into_boxed_str()); + eprintln!("warning: function call name resolution not fully implemented yet"); + let resolved_name = if !call.function_name.namespace.is_empty() { + ResolvedName::Project( + format!( + "{}{}", + call.function_name.namespace, call.function_name.basename + ) + .into_boxed_str(), + ) + } else { + ResolvedName::Project(call.function_name.basename.clone().into_boxed_str()) + }; let Some(function_ref) = ctx.function_search_ctx.find_function(&resolved_name) else { return Err(ResolveErrorKind::FailedToFindFunction { diff --git a/src/resolve/mod.rs b/src/resolve/mod.rs index b2969b7..0d42afd 100644 --- a/src/resolve/mod.rs +++ b/src/resolve/mod.rs @@ -252,7 +252,7 @@ pub fn resolve<'a>( }; let function_ref = resolved_ast.functions.insert(resolved::Function { - name, + name: name.clone(), parameters: resolve_parameters( type_search_ctx, source_files, @@ -285,11 +285,9 @@ pub fn resolve<'a>( .function_search_ctxs .get_or_insert_with(file_id, || FunctionSearchCtx::new()); - let resolved_name = ResolvedName::Project(function.name.clone().into_boxed_str()); - function_search_context .available - .entry(resolved_name) + .entry(name) .or_insert_with(|| vec![function_ref]); } }