mirror of
https://github.com/askama-rs/askama.git
synced 2025-10-02 07:20:55 +00:00
derive: linearize recursive function
This commit is contained in:
parent
35607eef43
commit
3840951ef3
@ -3007,11 +3007,13 @@ fn is_copyable_within_op(expr: &Expr<'_>, within_op: bool) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if this is an `Attr` where the `obj` is `"self"`.
|
/// Returns `true` if this is an `Attr` where the `obj` is `"self"`.
|
||||||
pub(crate) fn is_attr_self(expr: &Expr<'_>) -> bool {
|
pub(crate) fn is_attr_self(mut expr: &Expr<'_>) -> bool {
|
||||||
match expr {
|
loop {
|
||||||
Expr::Attr(obj, _) if matches!(***obj, Expr::Var("self")) => true,
|
match expr {
|
||||||
Expr::Attr(obj, _) if matches!(***obj, Expr::Attr(..)) => is_attr_self(obj),
|
Expr::Attr(obj, _) if matches!(***obj, Expr::Var("self")) => return true,
|
||||||
_ => false,
|
Expr::Attr(obj, _) if matches!(***obj, Expr::Attr(..)) => expr = obj,
|
||||||
|
_ => return false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user