Indexer as fallback to property.

This commit is contained in:
Stephen Chung
2021-05-18 20:12:30 +08:00
parent e64dad4e9f
commit dc9b4d7f4d
9 changed files with 155 additions and 79 deletions

View File

@@ -696,7 +696,7 @@ fn optimize_expr(expr: &mut Expr, state: &mut State) {
Expr::Dot(x, _) => match (&mut x.lhs, &mut x.rhs) {
// map.string
(Expr::Map(m, pos), Expr::Property(p)) if m.0.iter().all(|(_, x)| x.is_pure()) => {
let prop = &p.2.name;
let prop = p.2.0.as_str();
// Map literal where everything is pure - promote the indexed item.
// All other items can be thrown away.
state.set_dirty();