class

Analyzer::Rust::Salvo

Inherits Analyzer::Rust::RustEngine < FileScanEngine < Analyzer < FileHelper < Reference < Object

Salvo analyzer (tree-sitter port). Salvo wires routes in two shapes, both handled here:

  1. Router-chain DSL: Router::with_path("users/<id>").get(get_user) Router::new().path("users").hoop(auth).get(list).post(create) Each .<verb>(handler) is paired with the nearest enclosing .with_path(...) / .path(...) found by walking up its receiver chain — so middleware (.hoop(...)) and verb chaining (.get(a).post(b)) between the path and the verb don't break detection.

  2. Attribute macro: #[endpoint(method = Post, path = "/api/submit/<id>")] async fn submit_form(...) { ... }

Router chains are frequently assembled inside a vec![ ... ] macro (impl Routers { fn build() -> Vec<Router> { vec![Router::new()…] } }). tree-sitter leaves a macro body as a flat token_tree with no call_expression nodes, so those routes are invisible to a plain AST walk. We recover them by re-parsing each router-bearing macro body as an expression fragment and mapping line numbers back.

Constants

FN_EDGE_EVIDENCE_RE = Regex.union(".push(", ".unshift(")

Precompiled union for build_fn_external_prefixes' per-file evidence gate, so it costs a single PCRE2 match instead of two naive substring scans.

HTTP_VERBS = Set {"get", "post", "put", "delete", "patch", "head", "options"}
ROUTER_METHODS = Set {"push", "unshift", "path", "with_path", "hoop", "then", "get", "post", "put", "delete", "patch", "head", "options"}

A call worth treating as a router-chain top: a .push/.path/ .with_path/.<verb>/.hoop(...) method call or a Router::* base.

Class methods

tech_name
Source

Instance methods

analyze
Source
analyze_file(path : String) : Array(Endpoint)
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source

Nested types