sva_engine/arguments.rs
1// Concern: the numbers one instance's builtin calls were lowered with, and the operand each constant min/max chose | Non-concern: folding them (loops.rs), what a builtin does with them | IO: none
2
3use sva_ast::ByteSpan;
4
5/// Spans are bytes of the instance's own body text, as `outline` of that text reports them.
6#[derive(Clone, Debug, Default, PartialEq)]
7pub struct Arguments {
8 pub node: String,
9 pub calls: Vec<Called>,
10 pub chosen: Vec<Chosen>,
11}
12
13/// One builtin call and the number each named argument came to where it was lowered. A
14/// finite-difference solver answers its whole parameter set as the solver was handed it,
15/// `written` false for a default it filled in.
16#[derive(Clone, Debug, PartialEq)]
17pub struct Called {
18 pub name: String,
19 pub at: ByteSpan,
20 pub arguments: Vec<Argument>,
21}
22
23#[derive(Clone, Debug, PartialEq)]
24pub struct Argument {
25 pub name: String,
26 pub value: f64,
27 pub written: bool,
28}
29
30/// A `min` or `max` a call folded to a number; one in a filter's, cast's or `rand`'s
31/// positional is not listed.
32#[derive(Clone, Debug, PartialEq)]
33pub struct Chosen {
34 pub name: String,
35 pub at: ByteSpan,
36 pub operands: Vec<f64>,
37 pub chosen: usize,
38}