MCPcopy Index your code
hub / github.com/endbasic/endbasic / argspans_to_exprs

Function argspans_to_exprs

core/src/parser.rs:58–72  ·  view source on GitHub ↗

Converts a collection of `ArgSpan`s passed to a function or array reference to a collection of expressions with proper validation.

(spans: Vec<ArgSpan>)

Source from the content-addressed store, hash-verified

56/// Converts a collection of `ArgSpan`s passed to a function or array reference to a collection
57/// of expressions with proper validation.
58pub(crate) fn argspans_to_exprs(spans: Vec<ArgSpan>) -> Vec<Expr> {
59 let nargs = spans.len();
60 let mut exprs = Vec::with_capacity(spans.len());
61 for (i, span) in spans.into_iter().enumerate() {
62 debug_assert!(
63 (span.sep == ArgSep::End || i < nargs - 1)
64 || (span.sep != ArgSep::End || i == nargs - 1)
65 );
66 match span.expr {
67 Some(expr) => exprs.push(expr),
68 None => unreachable!(),
69 }
70 }
71 exprs
72}
73
74/// Operators that can appear within an expression.
75///

Callers 1

parse_dimMethod · 0.85

Calls 3

pushMethod · 0.80
lenMethod · 0.45
enumerateMethod · 0.45

Tested by

no test coverage detected