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
/// Minimal test for if-let pattern variable binding
/// Issue: Variables bound in if-let patterns are undefined in the generated code

plugin TestIfLetBinding {
    fn visit_variable_declarator(node: &mut VariableDeclarator, ctx: &Context) {
        // Test if-let with pattern binding
        if let Some(init) = &node.init {
            if let Expression::ArrayExpression(arr) = init {
                // arr should be bound here, not undefined
                let size = arr.elements.len();
            }
        }
    }
}