mirror of
https://github.com/askama-rs/askama.git
synced 2025-10-02 15:25:19 +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
|
DisplayWrap::Wrapped
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_bool_lit(&mut self, buf: &mut Buffer, s: &str) -> DisplayWrap {
|
fn visit_bool_lit(&mut self, buf: &mut Buffer, s: bool) -> DisplayWrap {
|
||||||
buf.write(s);
|
if s {
|
||||||
|
buf.write("true");
|
||||||
|
} else {
|
||||||
|
buf.write("false");
|
||||||
|
}
|
||||||
DisplayWrap::Unwrapped
|
DisplayWrap::Unwrapped
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ macro_rules! expr_prec_layer {
|
|||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub enum Expr<'a> {
|
pub enum Expr<'a> {
|
||||||
BoolLit(&'a str),
|
BoolLit(bool),
|
||||||
NumLit(&'a str),
|
NumLit(&'a str),
|
||||||
StrLit(&'a str),
|
StrLit(&'a str),
|
||||||
CharLit(&'a str),
|
CharLit(&'a str),
|
||||||
@ -334,8 +334,8 @@ impl<'a> Expr<'a> {
|
|||||||
let start = i;
|
let start = i;
|
||||||
map(path_or_identifier, |v| match v {
|
map(path_or_identifier, |v| match v {
|
||||||
PathOrIdentifier::Path(v) => Self::Path(v),
|
PathOrIdentifier::Path(v) => Self::Path(v),
|
||||||
PathOrIdentifier::Identifier(v @ "true") => Self::BoolLit(v),
|
PathOrIdentifier::Identifier("true") => Self::BoolLit(true),
|
||||||
PathOrIdentifier::Identifier(v @ "false") => Self::BoolLit(v),
|
PathOrIdentifier::Identifier("false") => Self::BoolLit(false),
|
||||||
PathOrIdentifier::Identifier(v) => Self::Var(v),
|
PathOrIdentifier::Identifier(v) => Self::Var(v),
|
||||||
})(i)
|
})(i)
|
||||||
.map(|(i, expr)| (i, WithSpan::new(expr, start)))
|
.map(|(i, expr)| (i, WithSpan::new(expr, start)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user