reluxscript 0.1.4

Write AST transformations once. Compile to Babel, SWC, and beyond.
Documentation
// Generated by ReluxScript compiler
// Do not edit manually

use swc_common::{Span, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_visit::{VisitMut, VisitMutWith};

#[derive(Debug, Clone)]
pub struct Stats {
    pub removed_count: i32,
}

pub struct ConsoleRemover {
    // Plugin state
}

impl ConsoleRemover {
    pub fn new() -> Self {
        Self {}
    }
    
    fn is_console_method(name: &String) -> bool {
        return (((name == "log") || (name == "warn")) || (name == "error"));
    }
}

impl VisitMut for ConsoleRemover {
    
    fn visit_mut_call_expr(&mut self, n: &mut CallExpr) {
        let callee = n.callee.clone();
        let args_count = n.arguments.len();
        if (args_count > 0) {
            for arg in n.arguments.clone() {
                let _temp = arg;
            }
        }
    }
    
    fn visit_mut_identifier(&mut self, n: &mut Ident) {
        let name = n.sym.clone();
        if (name == "oldName") {
            *n = Ident { sym: "newName".into(), span: DUMMY_SP };
        }
    }
}