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
// Test: Structs that are cloned should get #[derive(Clone)]

plugin TestDeriveClone {
    struct Item {
        name: Str,
        count: i32,
    }

    fn visit_identifier(node: &mut Identifier, ctx: &Context) {
        let item = Item { name: "test".into(), count: 1 };
        let cloned = item.clone();
    }
}