mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-30 22:41:13 +00:00
Store bool for BoolLit instead of str
This commit is contained in:
parent
bb77b1ea41
commit
eb4ceae2a3
@ -1888,8 +1888,12 @@ impl<'a> Generator<'a> {
|
||||
DisplayWrap::Wrapped
|
||||
}
|
||||
|
||||
fn visit_bool_lit(&mut self, buf: &mut Buffer, s: &str) -> DisplayWrap {
|
||||
buf.write(s);
|
||||
fn visit_bool_lit(&mut self, buf: &mut Buffer, s: bool) -> DisplayWrap {
|
||||
if s {
|
||||
buf.write("true");
|
||||
} else {
|
||||
buf.write("false");
|
||||
}
|
||||
DisplayWrap::Unwrapped
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ macro_rules! expr_prec_layer {
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum Expr<'a> {
|
||||
BoolLit(&'a str),
|
||||
BoolLit(bool),
|
||||
NumLit(&'a str),
|
||||
StrLit(&'a str),
|
||||
CharLit(&'a str),
|
||||
@ -334,8 +334,8 @@ impl<'a> Expr<'a> {
|
||||
let start = i;
|
||||
map(path_or_identifier, |v| match v {
|
||||
PathOrIdentifier::Path(v) => Self::Path(v),
|
||||
PathOrIdentifier::Identifier(v @ "true") => Self::BoolLit(v),
|
||||
PathOrIdentifier::Identifier(v @ "false") => Self::BoolLit(v),
|
||||
PathOrIdentifier::Identifier("true") => Self::BoolLit(true),
|
||||
PathOrIdentifier::Identifier("false") => Self::BoolLit(false),
|
||||
PathOrIdentifier::Identifier(v) => Self::Var(v),
|
||||
})(i)
|
||||
.map(|(i, expr)| (i, WithSpan::new(expr, start)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user