Skip to content

Commit 6cc06c6

Browse files
committed
fix Stack
1 parent 5da2073 commit 6cc06c6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/visitor/jsconfuser/stack.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const { parse } = require('@babel/parser')
12
const generator = require('@babel/generator').default
23
const t = require('@babel/types')
34

@@ -184,7 +185,7 @@ function checkStackInvalid(path, invalid) {
184185

185186
function checkChangeValid(invalid, used) {
186187
let valid = true
187-
Object.keys(used).forEach(function(key) {
188+
Object.keys(used).forEach(function (key) {
188189
if (Object.prototype.hasOwnProperty.call(invalid, key)) {
189190
valid = false
190191
}
@@ -291,7 +292,7 @@ function processStackParam(path, len) {
291292
while (changed) {
292293
checkStackInvalid(path, invalid)
293294
if (!checkChangeValid(invalid, used)) {
294-
path.replaceWith(prase(orig_code))
295+
path.replaceWith(parse(orig_code))
295296
used = {}
296297
}
297298
changed = tryStackReplace(path, len, invalid, used)
@@ -309,7 +310,9 @@ const deStackFuncLen = {
309310
let binding = obj.path.parentPath.scope.bindings[obj.name]
310311
for (const ref of binding.referencePaths) {
311312
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+
)
313316
continue
314317
}
315318
const repl_path = ref.parentPath

0 commit comments

Comments
 (0)