@@ -379,16 +379,25 @@ function processAssignLeft(vm, cache, path, prop_name, stk_name) {
379
379
vm . evalSync ( generator ( father . node ) . code )
380
380
cache [ prop_name ] = {
381
381
type : 'value' ,
382
- value : right . node . value ,
382
+ value : right . node ,
383
383
}
384
384
return
385
385
}
386
+ if ( right . isArrayExpression ( ) ) {
387
+ const elements = right . node . elements
388
+ if ( elements . length === 1 && elements [ 0 ] ?. value === 'charCodeAt' ) {
389
+ cache [ prop_name ] = {
390
+ type : 'value' ,
391
+ value : right . node ,
392
+ }
393
+ return
394
+ }
395
+ }
386
396
if ( right . isUnaryExpression ( ) && right . node . operator === '-' ) {
387
- const value = vm . evalSync ( generator ( right . node ) . code )
388
397
vm . evalSync ( generator ( father . node ) . code )
389
398
cache [ prop_name ] = {
390
399
type : 'value' ,
391
- value : value ,
400
+ value : right . node ,
392
401
}
393
402
return
394
403
}
@@ -442,7 +451,7 @@ function processReplace(cache, path, prop_name) {
442
451
return true
443
452
}
444
453
if ( type === 'value' ) {
445
- safeReplace ( path , value )
454
+ path . replaceWith ( value )
446
455
return true
447
456
}
448
457
return false
@@ -522,7 +531,10 @@ function tryStackReplace(path, len, invalid) {
522
531
}
523
532
524
533
function getStackParamLen ( path ) {
525
- const stk_name = path . node . params [ 0 ] . argument . name
534
+ const stk_name = path . node . params ?. [ 0 ] ?. argument ?. name
535
+ if ( ! stk_name ) {
536
+ return 'unknown'
537
+ }
526
538
const body_path = path . get ( 'body' )
527
539
let len = 'unknown'
528
540
body_path . traverse ( {
@@ -1712,6 +1724,8 @@ module.exports = function (code) {
1712
1724
traverse ( ast , deStringConcealingPlace )
1713
1725
// StringSplitting
1714
1726
traverse ( ast , calculateConstantExp )
1727
+ // Stack (run again)
1728
+ traverse ( ast , deStackFuncOther )
1715
1729
// OpaquePredicates
1716
1730
traverse ( ast , deOpaquePredicates )
1717
1731
traverse ( ast , calculateConstantExp )
0 commit comments