aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared/src/generator.rs
diff options
context:
space:
mode:
authorLibravatar René Kijewski <kijewski@library.vetmed.fu-berlin.de>2021-08-25 02:00:41 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2021-08-25 19:03:19 +0200
commit35cf03cf794b515afdb24a989e07b6acd0e2fc19 (patch)
tree9d8c4e22e99390b4939f0499394c5dd54ac113f0 /askama_shared/src/generator.rs
parent81429636eb295ec03ef35cf77648d1626970fd4e (diff)
downloadaskama-35cf03cf794b515afdb24a989e07b6acd0e2fc19.tar.gz
askama-35cf03cf794b515afdb24a989e07b6acd0e2fc19.tar.bz2
askama-35cf03cf794b515afdb24a989e07b6acd0e2fc19.zip
Parse boolean literals in assignment targets
268d825 introduced a regression that made matching against boolean literals impossible. E.g. "true" was interpreted as the variable "r#true". This PR fixes the problem. The bug was reported by @Restioson in issue #531.
Diffstat (limited to 'askama_shared/src/generator.rs')
-rw-r--r--askama_shared/src/generator.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
index dccda93..ec468e5 100644
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -1484,6 +1484,12 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
}
self.visit_char_lit(buf, s);
}
+ Target::BoolLit(s) => {
+ if first_level {
+ buf.write("&");
+ }
+ buf.write(s);
+ }
}
}