reluxscript 0.1.4

Write AST transformations once. Compile to Babel, SWC, and beyond.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// Minimal test for Vec.push() generating += instead of .push()
/// Issue: vec.push(item) generates vec += item instead of vec.push(item)

plugin TestVecPush {
    struct Item {
        name: Str,
    }

    struct State {
        items: Vec<Item>,
    }

    fn visit_identifier(node: &mut Identifier, ctx: &Context) {
        let item = Item { name: "test".into() };
        self.state.items.push(item);
    }
}