From 7d9c392be5e9933290ad843db1f3abbd7168c30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=95=E8=88=9E=E5=85=AB=E5=BC=A6?= <2597245950@qq.com> Date: Wed, 15 Dec 2021 22:11:08 +0800 Subject: [PATCH] fix --- package.json | 2 +- packages/linux-x64/package.json | 2 +- packages/mac-x64/package.json | 2 +- packages/win-x64/package.json | 2 +- swc-plugin-negative-indices/src/lib.rs | 9 ++++----- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index be2da14..c54a419 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "swc-plugin-negative-indices", - "version": "1.0.5", + "version": "1.0.6", "main": "index.js", "author": "RiESAEX <2597245950@qq.com>", "files":[], diff --git a/packages/linux-x64/package.json b/packages/linux-x64/package.json index 3a52fbc..476106c 100644 --- a/packages/linux-x64/package.json +++ b/packages/linux-x64/package.json @@ -1,6 +1,6 @@ { "name": "swc-plugin-negative-indices-linux-x64-musl", - "version": "1.0.5", + "version": "1.0.6", "main": "libswc_plugin_negative_indices.so", "author": "RiESAEX <2597245950@qq.com>", "license": "MIT", diff --git a/packages/mac-x64/package.json b/packages/mac-x64/package.json index d38bdcd..686e34e 100644 --- a/packages/mac-x64/package.json +++ b/packages/mac-x64/package.json @@ -1,6 +1,6 @@ { "name": "swc-plugin-negative-indices-darwin-x64", - "version": "1.0.5", + "version": "1.0.6", "main": "libswc_plugin_negative_indices.dylib", "author": "RiESAEX <2597245950@qq.com>", "license": "MIT", diff --git a/packages/win-x64/package.json b/packages/win-x64/package.json index 54b46bf..3ee5192 100644 --- a/packages/win-x64/package.json +++ b/packages/win-x64/package.json @@ -1,6 +1,6 @@ { "name": "swc-plugin-negative-indices-win32-x64-msvc", - "version": "1.0.5", + "version": "1.0.6", "main": "swc_plugin_negative_indices.dll", "author": "RiESAEX <2597245950@qq.com>", "license": "MIT", diff --git a/swc-plugin-negative-indices/src/lib.rs b/swc-plugin-negative-indices/src/lib.rs index 31c14a7..0b29058 100644 --- a/swc-plugin-negative-indices/src/lib.rs +++ b/swc-plugin-negative-indices/src/lib.rs @@ -2,10 +2,8 @@ use serde::Deserialize; use swc_atoms::js_word; use swc_common::util::take::Take; use swc_common::DUMMY_SP; -use swc_ecmascript::ast::{ - BinExpr, BinaryOp, Expr, ExprOrSuper, Ident, Lit, Number, UnaryExpr, UnaryOp, -}; -use swc_ecmascript::visit::{Fold, VisitMut}; +use swc_ecmascript::ast::{BinExpr, BinaryOp, Expr, Ident, Lit, UnaryExpr, UnaryOp}; +use swc_ecmascript::visit::{Fold, VisitMut, VisitMutWith}; use swc_ecmascript::{ast::MemberExpr, visit::as_folder}; use swc_plugin::define_js_plugin; define_js_plugin!(my_plugin); @@ -20,9 +18,10 @@ struct MyPlugin; impl VisitMut for MyPlugin { fn visit_mut_member_expr(&mut self, expr: &mut MemberExpr) { + expr.visit_mut_children_with(self); match &mut *expr.prop { Expr::Unary(UnaryExpr { - span, + span: _, op: UnaryOp::Minus, arg, }) => match &mut **arg {