data Expr
An expression of a body, in pre-order. depth is the nesting depth (0 = a top-level expression of the body).
name is the name a node refers to (a path, a called function or method, a field, an operator); text is the source
text (for literals: the literal as written; long texts are cut at 200 bytes).
Example:
use std.comptime { Decl, warn }
comptime fn no_unwrap_in_api(d: Decl) {
if !d.isPub { return }
for e in d.exprs {
if e.kind == "panic" {
warn(e.span, "{d.name} panics at depth {e.depth}")
}
}
}pub(api) data ExprSince. 1.0.0-beta
Fields
pub(api) kind: str | Kind of the expression node, as lower-case text ( |
pub(api) name: str | The name the node refers to: a path, a called function or method, a field or an operator. |
pub(api) text: str | Source text of the node (a literal as written; cut at 200 bytes). |
pub(api) depth: u32 | Nesting depth: 0 for a top-level expression of the body. |
pub(api) span: Span | Where the expression is written. |
Defined in: std/comptime/comptime.oxl:122