efront 4.25.2 → 4.25.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,7 +21,7 @@ var needfoot_reg = /(\:\:|\.)$/;
21
21
  var skipAssignment = function (o, cx) {
22
22
  if (!o) return;
23
23
  var next = arguments.length === 1 ? function () {
24
- o = o.next;
24
+ o = getnext(o);
25
25
  } : function () {
26
26
  o = body[++ox];
27
27
  cx = ox;
@@ -34,7 +34,7 @@ var skipAssignment = function (o, cx) {
34
34
  while (o && o.type & (SPACE | COMMENT)) o = body[++ox];
35
35
  cx = ox;
36
36
  }
37
- else if (o.type & (SPACE | COMMENT)) o = o.next;
37
+ else if (o.type & (SPACE | COMMENT)) o = getnext(o);
38
38
  var needpunc = false;
39
39
  var qcount = 0;
40
40
  var condition = false;
@@ -51,7 +51,7 @@ var skipAssignment = function (o, cx) {
51
51
  switch (o.text) {
52
52
  case ";":
53
53
  if (!ifdeep) break loop;
54
- var n = o.next;
54
+ var n = getnext(o);
55
55
  if (!n || n.type !== STRAP || n.text !== 'else') break loop;
56
56
  next();
57
57
  break;
@@ -79,7 +79,7 @@ var skipAssignment = function (o, cx) {
79
79
  break;
80
80
  case ":":
81
81
  if (qcount === 0) {
82
- var p = o.prev;
82
+ var p = getprev(o);
83
83
  if (p && p.type === LABEL) {
84
84
  next();
85
85
  break;
@@ -119,7 +119,7 @@ var skipAssignment = function (o, cx) {
119
119
  next();
120
120
  break;
121
121
  }
122
- var prev = o.prev;
122
+ var prev = getprev(o);
123
123
  if (prev?.type === EXPRESS && needfoot_reg.test(prev.text)) {
124
124
  next();
125
125
  break;
@@ -222,45 +222,45 @@ var skipAssignment = function (o, cx) {
222
222
  function skipSentenceQueue(o) {
223
223
  do {
224
224
  o = skipAssignment(o)
225
- } while (o && o.type === STAMP && o.text === ',' ? o = o.next : false);
225
+ } while (o && o.type === STAMP && o.text === ',' ? o = getnext(o) : false);
226
226
  return o;
227
227
  }
228
228
  function skipFunction(o) {
229
- if (o.type === STRAP && o.text === 'async') o = o.next;
229
+ if (o.type === STRAP && o.text === 'async') o = getnext(o);
230
230
  if (o.type !== STRAP) return skipAssignment(o);
231
231
  if (o.text === 'function') {
232
- while (o && (o.type !== SCOPED || o.entry !== '{')) o = o.next;
233
- return o.next;
232
+ while (o && (o.type !== SCOPED || o.entry !== '{')) o = getnext(o);
233
+ return getnext(o);
234
234
  }
235
235
  if (o.text === 'class') {
236
- while (!o.isClass) o = o.next;
237
- while (o.isClass) o = o.next;
236
+ while (!o.isClass) o = getnext(o);
237
+ while (o.isClass) o = getnext(o);
238
238
  return o;
239
239
  }
240
240
  return o;
241
241
  }
242
242
  var getDoBeforeWhile = function (while_) {
243
- var p = while_.prev;
243
+ var p = getprev(while_);
244
244
  if (!p || p.type !== SCOPED || p.entry !== '{') return;
245
- p = p.prev;
245
+ p = getprev(p);
246
246
  if (p.type === STRAP && p.text === "do") return p;
247
247
  };
248
248
  var getIfElseHead = function (if_) {
249
249
  var p = if_;
250
250
  do {
251
251
  if_ = p;
252
- p = if_.prev;
252
+ p = getprev(if_);
253
253
  if (!p || p.type !== STRAP || p.text !== 'else') {
254
254
  return if_;
255
255
  }
256
- while (p && (p.type !== STRAP || p.text !== 'if')) p = p.prev;
256
+ while (p && (p.type !== STRAP || p.text !== 'if')) p = getprev(p);
257
257
  } while (p);
258
258
  };
259
259
  var getContitionHeadBeforeScoped = function (p, nodo) {
260
- var pp = p.prev;
260
+ var pp = getprev(p);
261
261
  if (pp.type !== STRAP) return;
262
262
  if (pp.text === 'await') {
263
- pp = pp.prev;
263
+ pp = getprev(pp);
264
264
  if (pp?.type === STRAP && pp.text === "for") {
265
265
  return pp;
266
266
  };
@@ -281,12 +281,12 @@ var getContitionHeadBeforeScoped = function (p, nodo) {
281
281
  }
282
282
  };
283
283
  var getFunctionHeadBeforeScoped = function (p) {
284
- var pp = p.prev;
285
- if (pp && pp.type === EXPRESS) pp = pp.prev;
286
- if (pp && pp.text === '*') pp = pp.prev;
284
+ var pp = getprev(p);
285
+ if (pp && pp.type === EXPRESS) pp = getprev(pp);
286
+ if (pp && pp.text === '*') pp = getprev(pp);
287
287
  if (pp && pp.type === STRAP && pp.text === 'function') {
288
288
  p = pp;
289
- pp = pp.prev;
289
+ pp = getprev(pp);
290
290
  if (pp && pp.type === STRAP && pp.text === 'async') {
291
291
  p = pp;
292
292
  }
@@ -294,19 +294,19 @@ var getFunctionHeadBeforeScoped = function (p) {
294
294
  }
295
295
  while (pp?.isprop) {
296
296
  p = pp;
297
- pp = pp.prev;
297
+ pp = getprev(pp);
298
298
  if (pp?.isend) break;
299
299
  }
300
300
  if (p.isprop) return p;
301
301
  }
302
302
  function snapSentenceHead(o) {
303
303
  // 只检查一级
304
- while (o && o.prev) {
305
- var p = o.prev;
304
+ while (o && getprev(o)) {
305
+ var p = getprev(o);
306
306
  if (o.entry === '(') {
307
307
  if (p.type & ~(STAMP | STRAP)) {
308
308
  o = p;
309
- p = o.prev;
309
+ p = getprev(o);
310
310
  if (!p) break;
311
311
  }
312
312
  var pp = getContitionHeadBeforeScoped(o, false);
@@ -314,7 +314,7 @@ function snapSentenceHead(o) {
314
314
  pp = getFunctionHeadBeforeScoped(o);
315
315
  if (pp) {
316
316
  o = pp;
317
- p = o.prev;
317
+ p = getprev(o);
318
318
  if (!p || p.type === STAMP && /^[,;]$/.test(p.text)) break;
319
319
  continue
320
320
  };
@@ -334,7 +334,7 @@ function snapSentenceHead(o) {
334
334
  if (p.type & (VALUE | QUOTED)) {
335
335
  if (maybeprop) {
336
336
  o = p;
337
- if (p.entry === '`' && p.prev && p.prev.type & ~(STAMP | STRAP)) o = p.prev;
337
+ if (p.entry === '`' && getprev(p) && getprev(p).type & ~(STAMP | STRAP)) o = getprev(p);
338
338
  continue;
339
339
  }
340
340
  break;
@@ -350,7 +350,7 @@ function snapSentenceHead(o) {
350
350
  var pp = getFunctionHeadBeforeScoped(p);
351
351
  if (pp) {
352
352
  o = pp;
353
- p = o.prev;
353
+ p = getprev(o);
354
354
  if (!p || p.type === STAMP && /^[,;]$/.test(p.text)) break;
355
355
  continue;
356
356
  }
@@ -363,7 +363,7 @@ function snapSentenceHead(o) {
363
363
  continue;
364
364
  }
365
365
  if (/^(in|instanceof|of|as|from)$/.test(p.text)) {
366
- o = p.prev;
366
+ o = getprev(p);
367
367
  continue;
368
368
  }
369
369
  if (/^(return|yield|break|continue)$/.test(p.text)) {
@@ -388,7 +388,7 @@ function snapSentenceHead(o) {
388
388
  }
389
389
  if (/^[\?\:]$/.test(p.text)) {
390
390
  if (o) {
391
- var e = snapExpressFoot(o).next;
391
+ var e = getnext(snapExpressFoot(o));
392
392
  if (!e || e.type === STAMP && equal_reg.test(e.text)) break;
393
393
  }
394
394
  }
@@ -403,37 +403,42 @@ function snapSentenceHead(o) {
403
403
  o = p;
404
404
  continue;
405
405
  }
406
- o = p.prev;
406
+ o = getprev(p);
407
407
  continue;
408
408
  }
409
409
  break;
410
410
  }
411
411
  while (o) {
412
- var p = o.prev;
412
+ var p = getprev(o);
413
413
  if (!p || p.type !== LABEL) break;
414
414
  o = p;
415
415
  }
416
416
  return o;
417
417
  }
418
418
  var getStrapHead = function (o) {
419
- var p = o.prev;
419
+ var p = getprev(o);
420
420
  if (p && p.type === STRAP && !p.transive) return p;
421
- if (p && p.type === STRAP && p.text === 'await') p = p.prev;
421
+ if (p && p.type === STRAP && p.text === 'await') p = getprev(p);
422
422
  if (p && p.type === STRAP && p.text === 'for') return p;
423
423
  return null;
424
424
  }
425
+ var getprev = function (o) {
426
+ return o.prev;
427
+ };
428
+ var getnext = function (o) {
429
+ return o.next;
430
+ };
425
431
  var snapExpressHead = function (o) {
426
432
  if (!o || o.type & ~(EXPRESS | SCOPED | QUOTED) && !o.needle) return o;
427
- var a = o;
428
- while (o && o.prev) {
429
- var p = o.prev;
433
+ var a = o, p = getprev(o);
434
+ while (o && (p = getprev(o))) {
430
435
  if (p.type === STAMP && p.needle || o.type === STAMP && o.needle) {
431
436
  o = p;
432
437
  continue;
433
438
  }
434
439
  if (p && p.type === STRAP && p.text === 'new') return p;
435
440
  if (o.type === SCOPED && o.entry === '(') {
436
- var h = getStrapHead(o);
441
+ var h = getStrapHead(o, getprev);
437
442
  if (h) return h;
438
443
  }
439
444
  if (o.type === SCOPED && o.entry !== '{'
@@ -442,7 +447,7 @@ var snapExpressHead = function (o) {
442
447
  || o.type === QUOTED && (o.length || /^\`/.test(o.text))
443
448
  ) {
444
449
  if (p.type === SCOPED && p.entry === '(') {
445
- if (getStrapHead(p)) return o;
450
+ if (getStrapHead(p, getprev)) return o;
446
451
  }
447
452
  if (p.type & (EXPRESS | VALUE | QUOTED | SCOPED)) {
448
453
  a = o;
@@ -455,18 +460,18 @@ var snapExpressHead = function (o) {
455
460
  if (o.isObject) return o;
456
461
  if (!o.isClass) {
457
462
  if (p.type === SCOPED && p.entry === "(") {
458
- p = p.prev;
459
- if (p && p.type === EXPRESS) p = p.prev;
460
- if (p && p.type === STAMP && p.text === '*') p = p.prev;
463
+ p = getprev(p);
464
+ if (p && p.type === EXPRESS) p = getprev(p);
465
+ if (p && p.type === STAMP && p.text === '*') p = getprev(p);
461
466
  if (!p || p.type !== STRAP || !/^function$/.test(p.text)) return a;
462
- if (p && p.type === STRAP && p.text === "new") p = p.prev;
467
+ if (p && p.type === STRAP && p.text === "new") p = getprev(p);
463
468
  return p;
464
469
  }
465
470
  return a;
466
471
  }
467
472
  while (o.isClass) {
468
473
  isclass++;
469
- o = o.prev;
474
+ o = getprev(o);
470
475
  }
471
476
  var p = o;
472
477
  while (o && isclass > 0) {
@@ -474,7 +479,7 @@ var snapExpressHead = function (o) {
474
479
  if (o.type === STRAP && o.text === 'class') {
475
480
  isclass--;
476
481
  }
477
- o = o.prev;
482
+ o = getprev(o);
478
483
  }
479
484
  if (p && p.type === STRAP && p.text === 'new') return p;
480
485
  return p;
@@ -485,30 +490,30 @@ var snapExpressHead = function (o) {
485
490
  };
486
491
 
487
492
  var snapExpressFoot = function (o) {
488
- while (o && o.next) {
493
+ while (o && getnext(o)) {
489
494
  if (o.needle) {
490
- o = o.next;
495
+ o = getnext(o);
491
496
  continue;
492
497
  }
493
498
  var n = null;
494
499
  var isExpress = o.isExpress;
495
500
  if (o.type & STRAP) {
496
501
  n = o;
497
- if (n.text === 'new') n = n.next;
502
+ if (n.text === 'new') n = getnext(n);
498
503
  if (n.text === 'function') {
499
- while (n && (n.type !== SCOPED || n.entry !== '{')) n = n.next;
504
+ while (n && (n.type !== SCOPED || n.entry !== '{')) n = getnext(n);
500
505
  }
501
506
  else if (n.text === 'class') {
502
507
  var n = o;
503
- while (n && !n.isClass) n = n.next;
504
- while (n && n.isClass) n = n.next;
508
+ while (n && !n.isClass) n = getnext(n);
509
+ while (n && n.isClass) n = getnext(n);
505
510
  }
506
511
  else break;
507
512
  o = n;
508
- n = o && o.next;
513
+ n = o && getnext(o);
509
514
  }
510
515
  else if (o.type & (EXPRESS | QUOTED | VALUE | SCOPED)) {
511
- n = o.next;
516
+ n = getnext(o);
512
517
  }
513
518
  if (!n) break;
514
519
  if (n.type === SCOPED && (o.entry !== '{' || isExpress)
@@ -531,8 +536,8 @@ var createScoped = function (parsed, wash) {
531
536
  scoped.isfunc = true;
532
537
  var dec = function (map, o) {
533
538
  var kind = o.text;
534
- o = o.next;
535
- while (o && o.type === STRAP) o = o.next;
539
+ o = getnext(o);
540
+ while (o && o.type === STRAP) o = getnext(o);
536
541
  var [declared, used0, o0, skiped] = getDeclared(o, kind);
537
542
  if (o0 !== o) {
538
543
  mergeTo(used, used0);
@@ -557,9 +562,9 @@ var createScoped = function (parsed, wash) {
557
562
  var isAster = false;
558
563
  var function_obj = null;
559
564
  if (o.type === STAMP && equal_reg.test(o.text)) {
560
- var p = snapExpressHead(o.prev);
565
+ var p = snapExpressHead(getprev(o));
561
566
  if (!p || p.type & (STRAP | STAMP) || p.type !== EXPRESS && !p.isExpress) {
562
- let n = o.next;
567
+ let n = getnext(o);
563
568
  if (n && n.type & (EXPRESS | VALUE)) {
564
569
  n.equal = o;
565
570
  }
@@ -569,7 +574,7 @@ var createScoped = function (parsed, wash) {
569
574
  }
570
575
  else if (o.text === '=' && p.type === SCOPED && !p.isprop) {
571
576
  if (!p.kind) {
572
- var pp = p.prev;
577
+ var pp = getprev(p);
573
578
  if (!pp || pp.type === STAMP || pp.type === STRAP) {
574
579
  getDeclared(p, 'assign');
575
580
  }
@@ -599,36 +604,38 @@ var createScoped = function (parsed, wash) {
599
604
  case EXPRESS:
600
605
  if (needhead_reg.test(o.text)) break;
601
606
 
602
- var prev = o.prev;
603
- if (prev) {
604
- if (prev.needle || prev.type === EXPRESS && needfoot_reg.test(prev.text)) break;
605
- if (prev.type === STRAP && prev.istype) {
606
- var o0 = dec(lets, prev);
607
+ var p = getprev(o);
608
+ if (p) {
609
+ if (p.needle || p.type === EXPRESS && needfoot_reg.test(p.text)) break;
610
+ if (p.type === STRAP && p.istype) {
611
+ var o0 = dec(lets, p);
607
612
  if (o0 && o0.type === SCOPED && o0.entry === "(") {
608
613
  isFunction = true;
609
614
  isScope = true;
610
615
  break;
611
616
  }
612
- if (o === o0) o = o.next;
617
+ if (o === o0) o = getnext(o);
613
618
  else o = o0;
614
619
  continue;
615
620
  }
616
621
  }
617
- if (o.next && o.next.type === STAMP && o.next.text === "=>") {
622
+ var on = getnext(o);
623
+ if (on && on.type === STAMP && on.text === "=>") {
618
624
  isScope = true;
619
625
  isArraw = true;
620
- isAsync = o.prev?.type === STRAP && o.prev.text === 'async';
626
+ var p = getprev(o);
627
+ isAsync = p?.type === STRAP && p.text === 'async';
621
628
  }
622
629
  else {
623
630
  var u = o.text;
624
631
  if (/^\.\.\./.test(u)) u = u.slice(3);
625
632
  var u = u.replace(/^([^\.\[\?\s\:]*)[\s\S]*$/, '$1');
626
633
  if (!u) break;
627
- var prev = o.prev;
628
- if (prev && prev.type === STAMP && /^(?:\+\+|\-\-)$/.test(prev.text)) {
629
- var pp = prev.prev;
634
+ var p = getprev(o);
635
+ if (p && p.type === STAMP && /^(?:\+\+|\-\-)$/.test(p.text)) {
636
+ var pp = getprev(p);
630
637
  if (!pp || pp.type === STAMP) {
631
- o.equal = o.prev;
638
+ o.equal = p;
632
639
  }
633
640
  }
634
641
  saveTo(used, u, o);
@@ -649,7 +656,7 @@ var createScoped = function (parsed, wash) {
649
656
  case "break":
650
657
  case "continue":
651
658
  if (o.isend) break;
652
- o = o.next;
659
+ o = getnext(o);
653
660
  if (o?.type === EXPRESS) {
654
661
  saveTo(labelused, o.text, o);
655
662
  }
@@ -672,21 +679,23 @@ var createScoped = function (parsed, wash) {
672
679
  case "let":
673
680
  case "const":
674
681
  m = lets;
675
- if (!o.next || o.next.type & ~(EXPRESS | STRAP) && (o.next.type !== SCOPED || o.next.entry === "(")) {
682
+ var n = getnext(o);
683
+ if (!n || n.type & ~(EXPRESS | STRAP) && (n.type !== SCOPED || n.entry === "(")) {
676
684
  o.type = EXPRESS;
677
685
  continue;
678
686
  }
679
687
  case "import":
680
688
  case "use":
681
- if (!o.next || o.next.type === QUOTED) break;
682
- if (o.next.needle) {
689
+ var n = getnext(o);
690
+ if (!n || n.type === QUOTED) break;
691
+ if (n.needle) {
683
692
  o.type = EXPRESS;
684
693
  continue;
685
694
  }
686
695
  case "var":
687
696
  m = m || vars;
688
697
  var o0 = dec(m, o);
689
- if (o0 === o) o = o.next;
698
+ if (o0 === o) o = getnext(o);
690
699
  else o = o0;
691
700
  continue loop;
692
701
  case "static":
@@ -694,16 +703,17 @@ var createScoped = function (parsed, wash) {
694
703
  case "fn":
695
704
  case "func":
696
705
  isFunction = true;
697
- var op = o.prev;
698
- if (op?.type === STRAP && op.text === 'async') {
706
+ var p = getprev(o);
707
+ if (p?.type === STRAP && p.text === 'async') {
699
708
  isAsync = true;
700
- o.isExpress = op.isExpress;
709
+ o.isExpress = p.isExpress;
701
710
  }
702
711
  function_obj = o;
703
- if (o.next.type === STAMP) {
712
+ var n = getnext(o);
713
+ if (n.type === STAMP) {
704
714
  isAster = true;
705
- o = o.next;
706
- o.isExpress = op?.isExpress;
715
+ o = getnext(o);
716
+ o.isExpress = p?.isExpress;
707
717
  }
708
718
  case "catch":
709
719
  if (s === 'catch') isCatch = true;
@@ -711,24 +721,24 @@ var createScoped = function (parsed, wash) {
711
721
  case "interface":
712
722
  if (/^interface|class$/.test(s)) isClass = true;
713
723
  if (!o.isExpress) {
714
- o = o.next;
724
+ o = getnext(o);
715
725
 
716
726
  if (o.type === EXPRESS) {
717
727
  vars[o.text] = true;
718
728
  o.kind = isFunction ? 'function' : 'class';
719
729
  saveTo(used, o.text, o);
720
- o = o.next;
721
- if (o?.type === ELEMENT) o = o.next;
730
+ o = getnext(o);
731
+ if (o?.type === ELEMENT) o = getnext(o);
722
732
  }
723
733
  }
724
734
  isScope = true;
725
735
  break;
726
736
  case "for":
727
- o = o.next;
737
+ o = getnext(o);
728
738
  if (o.type !== SCOPED && o.text === 'await') {
729
739
  if (o.type === EXPRESS) o.type = STRAP;
730
740
  funcbody.await = funcbody.async = true;
731
- o = o.next;
741
+ o = getnext(o);
732
742
  }
733
743
  isScope = true;
734
744
  break;
@@ -737,18 +747,19 @@ var createScoped = function (parsed, wash) {
737
747
  break;
738
748
  case SCOPED:
739
749
  if (o.entry === "(") {
740
- var prev = o.prev;
741
- if (o.next && o.next.type === STAMP && o.next.text === "=>") {
750
+ var p = getprev(o);
751
+ var n = getnext(o);
752
+ if (n?.type === STAMP && n.text === "=>") {
742
753
  isArraw = true;
743
754
  isScope = true;
744
- if (prev?.type === STRAP && prev.text === 'async') {
755
+ if (p?.type === STRAP && p.text === 'async') {
745
756
  isAsync = true;
746
757
  }
747
758
  }
748
- else if (prev?.isprop) {
759
+ else if (p?.isprop) {
749
760
  isFunction = true;
750
761
  isScope = true;
751
- var pp = o.prev.prev;
762
+ var pp = getprev(p);
752
763
  if (pp && pp.type === STAMP && pp.isprop) {
753
764
  isAster = true;
754
765
  }
@@ -811,20 +822,20 @@ var createScoped = function (parsed, wash) {
811
822
  }
812
823
  if (isArraw);
813
824
  else while (o && (o.type !== SCOPED || o.entry === '[')) {
814
- o = o.next;
825
+ o = getnext(o);
815
826
  if (o && o.type === EXPRESS) {
816
827
  var tack = o.text.replace(/[\.\[][\s\S]*$/, '');
817
828
  saveTo(used, tack, o);
818
- if (o.prev && o.prev.type === STRAP && o.prev.text === 'extends') continue;
829
+ var p = getprev(o);
830
+ if (p?.type === STRAP && p.text === 'extends') continue;
819
831
  lets[tack] = true;
820
832
  o.kind = isFunction ? 'function' : 'class';
821
- o = o.next;
833
+ o = getnext(o);
822
834
  }
823
835
  }
824
836
  if (!isFunction) while (o.type !== SCOPED) {
825
- // if (o.next && o.next.type === STAMP && o.next.text === "=>") break;
826
837
  o = run(o, 0);
827
- o = o.next;
838
+ o = getnext(o);
828
839
  if (!o) break;
829
840
  }
830
841
  if (!o);
@@ -846,15 +857,15 @@ var createScoped = function (parsed, wash) {
846
857
  else {
847
858
  run(o.first);
848
859
  }
849
- o = o.next;
860
+ o = getnext(o);
850
861
  if (!o);
851
- else if (o.type === STAMP && o.text === "=>") o = o.next;
862
+ else if (o.type === STAMP && o.text === "=>") o = getnext(o);
852
863
  }
853
864
  else if (isArraw) {
854
865
  vars[o.text] = true;
855
866
  o.kind = 'argument';
856
867
  saveTo(used, o.text, o);
857
- o = o.next.next;
868
+ o = getnext(getnext(o));
858
869
  }
859
870
  if (!o);
860
871
  else if (o.type === SCOPED && o.brace) {
@@ -862,12 +873,12 @@ var createScoped = function (parsed, wash) {
862
873
  o.scoped = scoped;
863
874
  o.isExpress = isExpress;
864
875
  run(o.first);
865
- if (isArraw && id >= 0 && o) o = o.next;
876
+ if (isArraw && id >= 0 && o) o = getnext(o);
866
877
  if (wash && isFunction) {
867
- var e = o.next;
878
+ var e = getnext(o);
868
879
  if (e && e.type === EXPRESS && /^[\.\[]/.test(e.text) || e && e.type === SCOPED && e.entry === "[") {
869
880
  scoped.target = true;
870
- e = e.next;
881
+ e = getnext(e);
871
882
  }
872
883
  if (e && e.type === SCOPED && e.entry === '(') {
873
884
  if (e.first) {
@@ -878,13 +889,13 @@ var createScoped = function (parsed, wash) {
878
889
  }
879
890
  }
880
891
  else if (isArraw) {
881
- var next = skipAssignment(o);
892
+ var n = skipAssignment(o);
882
893
  scoped.arraw = o;
883
894
  var u = o;
884
- while (o !== next) {
885
- var n = run(o, 0);
886
- if (o === n || n && n.entry === '{') o = n.next;
887
- else o = n;
895
+ while (o !== n) {
896
+ var n1 = run(o, 0);
897
+ if (o === n1 || n1 && n1.entry === '{') o = getnext(n1);
898
+ else o = n1;
888
899
  }
889
900
  }
890
901
  else {
@@ -892,18 +903,19 @@ var createScoped = function (parsed, wash) {
892
903
  if (o.type === STAMP && o.text === ";") break;
893
904
  o = run(o, 0);
894
905
  if (!o) break;
895
- var next = o.next;
896
- if (!next) break;
906
+ var n = getnext(o);
907
+ if (!n) break;
897
908
  var e = o;
898
- if (o.type === STAMP && /^(\+\+|\-\-)$/.test(o.text) && o.prev && o.prev.type === EXPRESS
909
+ var p = getprev(o);
910
+ if (o.type === STAMP && /^(\+\+|\-\-)$/.test(o.text) && p?.type === EXPRESS
899
911
  || (VALUE | QUOTED | SCOPED) & o.type
900
912
  || EXPRESS === o.type && !needfoot_reg.test(o.text)) {
901
- if ((VALUE | QUOTED | PROPERTY | LABEL) & next.type) break;
902
- if (EXPRESS === next.type && !/^[\.\[]/.test(next.text)) break;
903
- if (next.type === SCOPED && next.brace) break;
904
- if (next.type === STRAP && !next.isExpress) break;
913
+ if ((VALUE | QUOTED | PROPERTY | LABEL) & n.type) break;
914
+ if (EXPRESS === n.type && !/^[\.\[]/.test(n.text)) break;
915
+ if (n.type === SCOPED && n.brace) break;
916
+ if (n.type === STRAP && !n.isExpress) break;
905
917
  }
906
- o = next;
918
+ o = n;
907
919
  } while (o);
908
920
  }
909
921
  var map = isFunction ? vars : lets;
@@ -956,11 +968,29 @@ var createScoped = function (parsed, wash) {
956
968
  scoped = _scoped;
957
969
  }
958
970
  if (id >= 0) break;
959
- if (o) o = o.next;
971
+ if (o) o = getnext(o);
960
972
  }
961
973
  return o;
962
974
  };
963
- run(parsed.first);
975
+ if (parsed.first) run(parsed.first);
976
+ else {
977
+ rehead(parsed);
978
+ var { first, last } = parsed;
979
+ var gtprev = getprev;
980
+ var gtnext = getnext;
981
+ getnext = function (o) {
982
+ if (o === last) return null;
983
+ return gtnext(o);
984
+ };
985
+ getprev = function (o) {
986
+ if (o === first) return null;
987
+ return gtprev(o);
988
+ };
989
+ run(first);
990
+ getnext = gtnext;
991
+ getprev = gtprev;
992
+ }
993
+
964
994
  scoped.used = used;
965
995
  scoped.vars = vars;
966
996
  scoped.caps = used;
@@ -1002,19 +1032,19 @@ var createScoped = function (parsed, wash) {
1002
1032
  var hasEqual = function (s) {
1003
1033
  while (s) {
1004
1034
  if (s.equal) return true;
1005
- var sn = s.next;
1035
+ var sn = getnext(s);
1006
1036
  if (sn?.type === STRAP) {
1007
1037
  if (sn.text === 'of') return true;
1008
1038
  if (sn.text === "in") {
1009
1039
  var q = s.queue;
1010
1040
  if (q.entry === '(') {
1011
- var qp = q.prev;
1041
+ var qp = getprev(q);
1012
1042
  if (qp.type === STRAP && qp.text === 'await') qp = qp.text;
1013
1043
  if (qp.type === STRAP && qp.text === 'for') return true;
1014
1044
  }
1015
1045
  }
1016
1046
  }
1017
- var sp = s.prev;
1047
+ var sp = getprev(s);
1018
1048
  if (sp?.type === STRAP && sp.text === 'as') return true;
1019
1049
  s = s.queue;
1020
1050
  }
@@ -1027,14 +1057,14 @@ var getDeclared = function (o, kind, queue) {
1027
1057
  var attributes = [];
1028
1058
  var index = 0;
1029
1059
  loop: while (o) {
1030
- while (o && o.type === STAMP && o.text === ',') o = o.next, index++;
1060
+ while (o && o.type === STAMP && o.text === ',') o = getnext(o), index++;
1031
1061
  if (!o) {
1032
1062
  index--;
1033
1063
  break;
1034
1064
  }
1035
- var next = o.next;
1036
- if (next?.needle) {
1037
- o = next.next;
1065
+ var n = getnext(o);
1066
+ if (n?.needle) {
1067
+ o = getnext(n);
1038
1068
  continue;
1039
1069
  }
1040
1070
  if (o.isprop) {
@@ -1045,9 +1075,9 @@ var getDeclared = function (o, kind, queue) {
1045
1075
  else if (o.isdigit) prop = `[${prop}]`;
1046
1076
  else if (!/^\[[\s\S]*\]$/.test(prop)) prop = "." + prop;
1047
1077
  skiped.push(o);
1048
- if (o.next && o.next.type === STAMP && o.next.text === ":") {
1049
- o = o.next;
1050
- o = o.next;
1078
+ var n = getnext(o);
1079
+ if (n?.type === STAMP && n.text === ":") {
1080
+ o = getnext(n);
1051
1081
  }
1052
1082
  }
1053
1083
  switch (o.type) {
@@ -1062,40 +1092,41 @@ var getDeclared = function (o, kind, queue) {
1062
1092
  d.entry = o.entry;
1063
1093
  o.kind = kind;
1064
1094
  attributes.push([prop, d]);
1065
- o = o.next;
1095
+ o = getnext(o);
1066
1096
  break;
1067
1097
  }
1068
1098
  else {
1069
1099
  var s = [];
1070
1100
  while (foot !== o) {
1071
1101
  s.push(o);
1072
- o = o.next;
1102
+ o = getnext(o);
1073
1103
  }
1074
1104
  s.push(foot);
1075
1105
  skiped.push(...s);
1076
- o = o.next;
1106
+ o = getnext(o);
1077
1107
  attributes.push([prop, s]);
1078
1108
  break;
1079
1109
  }
1080
1110
  case STAMP:
1081
- var next = o.next;
1082
- if (o.text === "*" && next) {
1083
- if (next.type === STRAP && next.text === 'as') {
1084
- o = next.next;
1111
+ var n = getnext(o);
1112
+ if (o.text === "*" && n) {
1113
+ if (n.type === STRAP && n.text === 'as') {
1114
+ o = getnext(n);
1085
1115
  prop = "*";
1086
1116
  continue;
1087
1117
  }
1088
1118
  }
1089
1119
  if (o.text === '...') {
1090
- o = o.next;
1120
+ o = getnext(o);
1091
1121
  continue;
1092
1122
  }
1093
1123
  break;
1094
1124
  case PROPERTY:
1095
- if (o.next) {
1096
- if (o.next.type === STAMP && o.next.text === ":" || o.next.type === STRAP && o.next.text === "as") {
1125
+ var n = getnext(o);
1126
+ if (n) {
1127
+ if (n.type === STAMP && n.text === ":" || n.type === STRAP && n.text === "as") {
1097
1128
  prop = "." + o.text;
1098
- o = o.next.next;
1129
+ o = getnext(n);
1099
1130
  continue;
1100
1131
  }
1101
1132
  }
@@ -1109,7 +1140,7 @@ var getDeclared = function (o, kind, queue) {
1109
1140
  var isdec = !/[\.\[]/.test(k);
1110
1141
  if (k && isdec) declared.push(k);
1111
1142
  if (!isrest) {
1112
- var prev = o.prev;
1143
+ var prev = getprev(o);
1113
1144
  if (prev?.type === STAMP && prev.text === '...') {
1114
1145
  isrest = true;
1115
1146
  }
@@ -1130,11 +1161,11 @@ var getDeclared = function (o, kind, queue) {
1130
1161
  var f = snapExpressFoot(o);
1131
1162
  if (k) saveTo(used, k, o);
1132
1163
  var s = [o];
1133
- while (o !== f) o = o.next, s.push(o);
1164
+ while (o !== f) o = getnext(o), s.push(o);
1134
1165
  if (isrest) declared["..."] = [s, index];
1135
1166
  else attributes.push([prop, s]);
1136
1167
  o.kind = kind;
1137
- o = f.next;
1168
+ o = getnext(f);
1138
1169
  break;
1139
1170
  default:
1140
1171
  console.log(createString(pickSentence(o.queue)), o.text, o.type);
@@ -1144,36 +1175,36 @@ var getDeclared = function (o, kind, queue) {
1144
1175
  switch (o.type) {
1145
1176
  case STRAP:
1146
1177
  if (/^(in|of)$/.test(o.text)) {
1147
- o = o.next;
1178
+ o = getnext(o);
1148
1179
  break loop;
1149
1180
  }
1150
1181
  break loop;
1151
1182
  case STAMP:
1152
1183
  if (o.text === "=") {
1153
- o.prev.equal = o;
1154
- o = o.next;
1184
+ getprev(o).equal = o;
1185
+ o = getnext(o);
1155
1186
  var o0 = skipAssignment(o);
1156
1187
  if (isrest) throw new Error(i18n`余集变量不能有默认值`);
1157
1188
  attributes[attributes.length - 1].push(queue, o, o0);
1158
1189
  while (o !== o0) {
1159
1190
  skiped.push(o);
1160
- o = o.next;
1191
+ o = getnext(o);
1161
1192
  }
1162
1193
  o = o0;
1163
1194
  break;
1164
1195
  }
1165
1196
  if (o.text === '*') {
1166
- o = o.next;
1197
+ o = getnext(o);
1167
1198
  break;
1168
1199
  }
1169
1200
  break;
1170
1201
  case EXPRESS:
1171
- if (o.text === '?') o = o.next;
1202
+ if (o.text === '?') o = getnext(o);
1172
1203
  break;
1173
1204
  }
1174
1205
  if (o?.type === STAMP) {
1175
1206
  while (o?.istype) {
1176
- o = o.next;
1207
+ o = getnext(o);
1177
1208
  }
1178
1209
  }
1179
1210
  if (!o) break;
@@ -1229,7 +1260,8 @@ var hasBreakBetween = function (prev, next) {
1229
1260
  };
1230
1261
  var getSemicolonBetween = function (prev, next) {
1231
1262
  if (next.type === PROPERTY) return ";";
1232
- if (next.type === STAMP && next.text === "*" && next.next && next.next.type === PROPERTY) return ";";
1263
+ if (next.type === STAMP && next.text === "*" && getnext(next) && getnext(next).type === PROPERTY) return ";";
1264
+ var pp = getprev(prev);
1233
1265
  if (
1234
1266
  (EXPRESS | VALUE | QUOTED) & prev.type
1235
1267
  || prev.type === STAMP && /^(\+\+|\-\-)$/.test(prev.text)
@@ -1237,7 +1269,7 @@ var getSemicolonBetween = function (prev, next) {
1237
1269
  // 这两种分号不存在时efront的解析器可以识别,v8的识别不了,为了兼容追加分号
1238
1270
  // do{}while(); return
1239
1271
  // =function(){}(); return
1240
- prev.perv?.type === STRAP && prev.prev.text === 'while' || prev.prev?.type === SCOPED
1272
+ pp?.type === STRAP && pp.text === 'while' || pp?.type === SCOPED
1241
1273
  )
1242
1274
  )
1243
1275
  ) {
@@ -1328,7 +1360,7 @@ var createString = function (parsed) {
1328
1360
  var helpcolor = parsed.keepcolor === false;
1329
1361
  var intag = false;
1330
1362
  var run = (o, i, a) => {
1331
- var prev = o.prev;
1363
+ var prev = getprev(o);
1332
1364
  a: if (prev && lasttype !== SPACE && patchspace && ~(SPACE | COMMENT | STAMP | PIECE | SCOPED) & o.type) {
1333
1365
  if ((QUOTED | SCOPED | STRAP | LABEL | COMMENT | ELEMENT | PROPERTY) & lasttype
1334
1366
  || prev.type === STAMP && !prev.unary && !prev.needle && !prev.isprop
@@ -1441,7 +1473,7 @@ var createString = function (parsed) {
1441
1473
  break;
1442
1474
  }
1443
1475
  case SCOPED:
1444
- var prev = o.prev;
1476
+ var prev = getprev(o);
1445
1477
  if (patchspace && !intag && prev && o.type !== QUOTED && (lasttype === STAMP && !prev.unary && !prev.needle
1446
1478
  || lasttype & ~(SPACE | STAMP | COMMENT) && o.brace
1447
1479
  || lasttype === STRAP && !/^(this|arguments|import)$/.test(prev.text)
@@ -1456,13 +1488,14 @@ var createString = function (parsed) {
1456
1488
  }
1457
1489
  lasttype = SPACE;
1458
1490
  o.forEach(run);
1459
- if (o.prev && o.prev.type === STRAP && /^for$/.test(o.prev.text));
1491
+ var p = getprev(o);
1492
+ if (p?.type === STRAP && /^for$/.test(p.text));
1460
1493
  else if (/^[,;]$/.test(result[result.length - 1]) && autospace && !keepspace) {
1461
1494
  var last = o.last;
1462
- var lp = last && last.prev;
1495
+ var lp = last && getprev(last);
1463
1496
  if (!lp) result.pop();
1464
1497
  else {
1465
- var lpp = lp.prev;
1498
+ var lpp = getprev(lp);
1466
1499
  if (lp.type === STRAP && lp.text === 'else' || lp.type === SCOPED && lpp && lpp.type === STRAP && /^(while|if|with|for)/.test(lpp.text));
1467
1500
  else result.pop();
1468
1501
  }
@@ -1475,6 +1508,7 @@ var createString = function (parsed) {
1475
1508
  break;
1476
1509
  default:
1477
1510
  if (o && typeof o === "object") {
1511
+ var p = getprev(o);
1478
1512
  if (intag || o.needle || o.type & (EXPRESS | PROPERTY) && (needhead_reg.test(o.text) || lasttype & EXPRESS && needfoot_reg.test(prev?.text))) {
1479
1513
  if (prev?.isdigit && !/^0[\dxbo]|[mni]$|[e\.]/.test(prev.text) && lasttype & ~(SPACE | COMMENT)) result.push(" ");
1480
1514
  }
@@ -1484,28 +1518,26 @@ var createString = function (parsed) {
1484
1518
  ) {
1485
1519
  if (autospace || prev?.isdigit) result.push(" ");
1486
1520
  }
1487
- else if (o.prev && o.type === STAMP && !/^[,;]/.test(o.text)) {
1521
+ else if (p && o.type === STAMP && !/^[,;]/.test(o.text)) {
1488
1522
  if (result[result.length - 1] === " ");
1489
1523
  else if (o.text === ':') {
1490
- var p = o.prev;
1491
1524
  if ((lasttype === PROPERTY || p && p.isprop || !o.isExpress));
1492
1525
  else if (autospace) result.push(' ');
1493
1526
  }
1494
1527
  else if (lasttype === STAMP) {
1495
- var prev = o.prev;
1496
- if (autospace) if (!prev.unary || /[\+\-]$/.test(prev.text) && prev.text === o.text) result.push(" ");
1528
+ if (autospace) if (!p.unary || /[\+\-]$/.test(p.text) && p.text === o.text) result.push(" ");
1497
1529
  }
1498
- else if (/^(\+\+|\-\-)$/.test(o.prev.text) && o.prev.prev) {
1530
+ else if (/^(\+\+|\-\-)$/.test(p.text) && getprev(p)) {
1499
1531
  if (o.unary) {
1500
- var prev_prev = o.prev.prev;
1532
+ var pp = getprev(p);
1501
1533
  if (
1502
- prev_prev.type === STRAP && !prev_prev.isExpress
1503
- || prev_prev.type & (EXPRESS | VALUE)
1534
+ pp.type === STRAP && !pp.isExpress
1535
+ || pp.type & (EXPRESS | VALUE)
1504
1536
  ) result.push(";");
1505
1537
  }
1506
1538
  }
1507
1539
 
1508
- else if (!/^(\+\+|\-\-)$/.test(o.text) || o.prev && o.prev.type & (STAMP | STRAP)) {
1540
+ else if (!/^(\+\+|\-\-)$/.test(o.text) || p.type & (STAMP | STRAP)) {
1509
1541
  if (patchspace && lasttype !== SPACE && !o.needle) result.push(" ");
1510
1542
  }
1511
1543
  }
@@ -1576,13 +1608,13 @@ var isHalfSentence = function (body, i) {
1576
1608
  if (a.type === STRAP && a.text === 'else') return true;
1577
1609
  if (a.type === STAMP && (a.unary || !/^(;|\+\+|\-\-)$/.test(a.text))) return true;
1578
1610
  if (a.type !== SCOPED || a.entry !== "(") return false;
1579
- a = a.prev;
1611
+ a = getprev(a);
1580
1612
  if (!a || a.type !== STRAP) return false;
1581
1613
  if (a.text === 'while') {
1582
- var p = a.prev;
1583
- if (!p || p.type !== SCOPED || p.entry !== '{' || !p.prev) return true;
1584
- p = p.prev;
1585
- if (p.type !== STRAP || p.text !== 'do') return true;
1614
+ var p = getprev(a);
1615
+ if (!p || p.type !== SCOPED || p.entry !== '{') return true;
1616
+ p = getprev(p);
1617
+ if (!p || p.type !== STRAP || p.text !== 'do') return true;
1586
1618
  return false;
1587
1619
  }
1588
1620
  return /^(if|for|with)$/.test(a.text);
@@ -1592,8 +1624,8 @@ var splice = function (queue, index, size, ...args) {
1592
1624
  if (index < 0) index += queue.length;
1593
1625
  var p = queue[index];
1594
1626
  var n = queue[index + size - 1];
1595
- var prev = p && p.prev;
1596
- var next = n && n.next;
1627
+ var prev = p && getprev(p);
1628
+ var next = n && getnext(n);
1597
1629
  var res = queue.splice(index, size, ...args);
1598
1630
  var previ = queue.lastIndexOf(prev, index);
1599
1631
  var nexti = queue.indexOf(next, index + args.length);
@@ -1601,8 +1633,8 @@ var splice = function (queue, index, size, ...args) {
1601
1633
  if (nexti < 0) nexti = queue.length, next = null;
1602
1634
  else nexti++;
1603
1635
  var changedargs = queue.slice(previ, nexti);
1604
- var pp = prev && prev.prev;
1605
- var nn = next && next.next;
1636
+ var pp = prev && getprev(prev);
1637
+ var nn = next && getnext(next);
1606
1638
  relink(changedargs);
1607
1639
  if (pp) changedargs.first.prev = pp, pp.next = changedargs.first;
1608
1640
  else queue.first = changedargs.first;
@@ -1680,20 +1712,20 @@ var canbeDuplicate = function (body) {
1680
1712
  };
1681
1713
  var pickArgument = function (o) {
1682
1714
  var res = [];
1683
- var t = o && o.prev, p = o;
1715
+ var t = o && getprev(o), p = o;
1684
1716
  while (t && (t.type !== STAMP || !/^[,;]$/.test(t.text))) {
1685
1717
  if (p.isprop) {
1686
- p = t.prev;
1718
+ p = getprev(t);
1687
1719
  if (!p || !p.isprop) break;
1688
1720
  }
1689
1721
  res.push(t);
1690
1722
  p = t;
1691
- t = t.prev;
1723
+ t = getprev(t);
1692
1724
  }
1693
1725
  while (o && (o.type !== STAMP || !/^[,;]$/.test(o.text))) {
1694
1726
  res.push(o);
1695
1727
  var n = o;
1696
- o = o.next;
1728
+ o = getnext(o);
1697
1729
  if (o && o.isprop) {
1698
1730
  if (!n.isprop) break;
1699
1731
  }
@@ -1702,15 +1734,15 @@ var pickArgument = function (o) {
1702
1734
  };
1703
1735
  var pickSentence = function (o) {
1704
1736
  if (!o) return [];
1705
- if (o && o.type & (SPACE | COMMENT) && o.prev) o = o.prev;
1706
- if (o && o.type === STAMP && o.prev) o = o.prev;
1707
- if (o.type === STRAP && /^(in|instanceof|as|of)$/.test(o.text) && o.prev) o = o.prev;
1737
+ if (o && o.type & (SPACE | COMMENT) && getprev(o)) o = getprev(o);
1738
+ if (o && o.type === STAMP && getprev(o)) o = getprev(o);
1739
+ if (o.type === STRAP && /^(in|instanceof|as|of)$/.test(o.text) && getprev(o)) o = getprev(o);
1708
1740
  var h = snapSentenceHead(o);
1709
1741
  var e = h;
1710
1742
  do {
1711
1743
  e = skipAssignment(e);
1712
1744
  if (!e || e.type !== STAMP || e.text !== ',') break;
1713
- e = e.next;
1745
+ e = getnext(e);
1714
1746
  } while (e);
1715
1747
  var q = o.queue;
1716
1748
  if (q) {
@@ -1721,7 +1753,7 @@ var pickSentence = function (o) {
1721
1753
  var res = [];
1722
1754
  do {
1723
1755
  res.push(h);
1724
- h = h.next;
1756
+ h = getnext(h);
1725
1757
  } while (h !== e);
1726
1758
  return res;
1727
1759
  };
@@ -1740,7 +1772,7 @@ var pickAssignment = function (n) {
1740
1772
  var values = [];
1741
1773
  while (n && n !== e) {
1742
1774
  values.push(n);
1743
- n = n.next;
1775
+ n = getnext(n);
1744
1776
  }
1745
1777
  return values;
1746
1778
  }
@@ -1750,7 +1782,7 @@ var insertBefore = function () {
1750
1782
  var index = queue.indexOf(o);
1751
1783
  var os = [].slice.call(arguments, 1);
1752
1784
  queue.splice.apply(queue, [index, 0].concat(os));
1753
- var prev = o && o.prev, next = o;
1785
+ var prev = o && getprev(o), next = o;
1754
1786
  var desc = { value: queue, configurable: true, enumerable: false }
1755
1787
  for (var o of os) {
1756
1788
  if (prev) prev.next = o;
@@ -1769,7 +1801,7 @@ var insertAfter = function () {
1769
1801
  var index = queue.indexOf(o) + 1;
1770
1802
  var os = [].slice.call(arguments, 1);
1771
1803
  queue.splice.apply(queue, [index, 0].concat(os));
1772
- var prev = o, next = o && o.next;
1804
+ var prev = o, next = o && getnext(o);
1773
1805
  var desc = { value: queue, configurable: true, enumerable: false }
1774
1806
  for (var o of os) {
1775
1807
  if (prev) prev.next = o;
@@ -1860,7 +1892,7 @@ var isDeclareOnly = function (o) {
1860
1892
  if (!q.kind) break;
1861
1893
  o = q;
1862
1894
  }
1863
- var n = o.next;
1895
+ var n = getnext(o);
1864
1896
  if (!n) return true;
1865
1897
  if (n.type !== STAMP || /^[,;]$/.test(n.text)) return true;
1866
1898
  return false;