reluxscript 0.1.4

Write AST transformations once. Compile to Babel, SWC, and beyond.
Documentation
/**
 * Test: Simple null operators
 */
plugin TestNullSimple {

    struct State {
        result: Str,
    }

    fn init() -> State {
        State { result: "" }
    }

    pub fn visit_identifier(node: &Identifier) {
        // Test ?? (null-coalescing) with Options
        let opt1: Option<Str> = Some("a".to_string());
        let opt2: Option<Str> = Some("b".to_string());
        let result = opt1 ?? opt2 ?? "c".to_string();

        self.state.result = result;
    }

    fn finish() -> Str {
        self.state.result
    }
}