Skip to main content

vvv_core/
calls.rs

1//! Syntactic call sites and declarative extraction rules; no target inference.
2use crate::Span;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
7#[serde(rename_all = "snake_case")]
8pub enum CallKind {
9    Direct,
10    Member,
11    Indirect,
12}
13
14#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
15#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
16pub struct CallSite {
17    pub span: Span,
18    pub callee: Span,
19    pub kind: CallKind,
20    /// Name span of the nearest named callable, absent inside anonymous callables.
21    pub owner: Option<Span>,
22}
23
24#[derive(Debug, Clone, Copy, PartialEq, Eq)]
25pub struct CallRule {
26    pub node: &'static str,
27    pub callee: &'static str,
28}
29
30/// Select the relevant child of a callee. None unwraps without classifying it.
31#[derive(Debug, Clone, Copy, PartialEq, Eq)]
32pub struct CalleeRule {
33    pub node: &'static str,
34    pub field: &'static str,
35    pub kind: Option<CallKind>,
36}