desugars operator overloading
do indexings
bendn 12 months ago
parent 4813f11 · commit 3e4e0c9
-rw-r--r--Cargo.toml2
-rw-r--r--src/lib.rs5
2 files changed, 6 insertions, 1 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 79b27db..f372dc9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "lower-macros"
-version = "0.2.3"
+version = "0.2.4"
authors = ["bend-n <[email protected]>"]
description = "desugar math where the compiler wont"
edition = "2021"
diff --git a/src/lib.rs b/src/lib.rs
index 00b31e7..9b184e2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -207,6 +207,11 @@ fn walk(sub: &impl Sub, e: Expr) -> TokenStream {
}) => {
quote_with!(cond = walk(*cond); body =map_block(body) => #label while #cond #body)
}
+ Expr::Index(ExprIndex { expr, index, .. }) => {
+ let expr = walk(*expr);
+ let index = walk(*index);
+ quote!(#expr [ #index ])
+ }
Expr::Loop(ExprLoop { label, body, .. }) => {
quote_with!(body =map_block(body) => #label loop #body)
}