Skip to main content

xsd_schema/xpath/ast/
functions.rs

1// ============================================================================
2// Function Call
3// ============================================================================
4
5use super::{AstNodeId, SourceSpan};
6use crate::xpath::functions::FunctionHandle;
7
8/// Function call expression (`prefix:name(args...)`).
9#[derive(Debug, Clone)]
10pub struct FunctionCallNode {
11    /// Namespace prefix (empty string if none, defaults to fn namespace).
12    pub prefix: String,
13    /// Function local name.
14    pub local_name: String,
15    /// Argument expressions.
16    pub args: Vec<AstNodeId>,
17    /// Source location.
18    pub span: SourceSpan,
19    /// Resolved function handle (set during binding phase).
20    ///
21    /// This replaces the previous `function_id` field. The handle works for
22    /// both built-in and custom functions.
23    pub function_handle: Option<FunctionHandle>,
24}
25
26impl FunctionCallNode {
27    pub fn new(prefix: String, local_name: String, args: Vec<AstNodeId>, span: SourceSpan) -> Self {
28        Self {
29            prefix,
30            local_name,
31            args,
32            span,
33            function_handle: None,
34        }
35    }
36}