Returns a statically-known `END` exit code and its source position, if any.
(expr: &Expr)
| 93 | |
| 94 | /// Returns a statically-known `END` exit code and its source position, if any. |
| 95 | fn static_end_code(expr: &Expr) -> Option<(i32, LineCol)> { |
| 96 | match expr { |
| 97 | Expr::Integer(span) => Some((span.value, span.pos)), |
| 98 | Expr::Negate(span) => { |
| 99 | let Expr::Integer(inner) = &span.expr else { |
| 100 | return None; |
| 101 | }; |
| 102 | inner.value.checked_neg().map(|value| (value, span.pos)) |
| 103 | } |
| 104 | _ => None, |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | /// Returns true if `expr` references `target_key`. |
| 109 | fn expr_references_symbol(expr: &Expr, target_key: &SymbolKey) -> bool { |