1
+ const { parse } = require ( '@babel/parser' )
1
2
const generator = require ( '@babel/generator' ) . default
2
3
const t = require ( '@babel/types' )
3
4
@@ -184,7 +185,7 @@ function checkStackInvalid(path, invalid) {
184
185
185
186
function checkChangeValid ( invalid , used ) {
186
187
let valid = true
187
- Object . keys ( used ) . forEach ( function ( key ) {
188
+ Object . keys ( used ) . forEach ( function ( key ) {
188
189
if ( Object . prototype . hasOwnProperty . call ( invalid , key ) ) {
189
190
valid = false
190
191
}
@@ -291,7 +292,7 @@ function processStackParam(path, len) {
291
292
while ( changed ) {
292
293
checkStackInvalid ( path , invalid )
293
294
if ( ! checkChangeValid ( invalid , used ) ) {
294
- path . replaceWith ( prase ( orig_code ) )
295
+ path . replaceWith ( parse ( orig_code ) )
295
296
used = { }
296
297
}
297
298
changed = tryStackReplace ( path , len , invalid , used )
@@ -309,7 +310,9 @@ const deStackFuncLen = {
309
310
let binding = obj . path . parentPath . scope . bindings [ obj . name ]
310
311
for ( const ref of binding . referencePaths ) {
311
312
if ( ref . key !== 'callee' ) {
312
- console . warn ( `[Stack] Unexpected ref of functionLengthName: ${ obj . name } ` )
313
+ console . warn (
314
+ `[Stack] Unexpected ref of functionLengthName: ${ obj . name } `
315
+ )
313
316
continue
314
317
}
315
318
const repl_path = ref . parentPath
0 commit comments