efront 4.0.17 → 4.0.19
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.
- package/coms/basic/strings.js +7 -2
- package/coms/basic_/Symbol.js +3 -1
- package/coms/basic_/aster_.js +6 -6
- package/coms/basic_/asyncAster_.js +13 -19
- package/coms/basic_/exec_.js +10 -5
- package/coms/compile/Javascript.js +10 -9
- package/coms/compile/common.js +52 -19
- package/coms/compile/downLevel.js +40 -15
- package/coms/compile/downLevel_test.js +63 -10
- package/coms/compile/powermap.js +1 -1
- package/coms/compile/unstruct.js +135 -52
- package/coms/compile/unstruct_test.js +14 -2
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/compile/unstruct.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var { SPACE, COMMENT, EXPRESS, STRAP, QUOTED, STAMP, SCOPED, VALUE, LABEL, createString, skipAssignment, splice, relink, createExpressList, snapExpressHead, snapExpressFoot } = require("./common");
|
|
1
|
+
var { SPACE, COMMENT, EXPRESS, STRAP, QUOTED, STAMP, SCOPED, VALUE, LABEL, createString, skipAssignment, skipSentenceQueue, isHalfSentence, splice, relink, createExpressList, snapExpressHead, snapExpressFoot } = require("./common");
|
|
2
2
|
var scanner2 = require("./scanner2");
|
|
3
3
|
var RE = { type: STRAP, text: "@re" };// if (_) return
|
|
4
4
|
var RZ = { type: STRAP, text: "@rz" };// if (!_) return
|
|
@@ -64,28 +64,31 @@ var _try = function (body, cx, unblock, result, getname) {
|
|
|
64
64
|
var final = stepReturn(0, 9);
|
|
65
65
|
pushstep(result, final);
|
|
66
66
|
o = o.next;
|
|
67
|
-
if (o.type !== STRAP || o.text !== 'catch') throw `缺少catch语句`;
|
|
68
|
-
o = o.next;
|
|
69
|
-
var arg = [];
|
|
70
67
|
var catchoffset = result.length;
|
|
71
|
-
if (o.type ===
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
if (o.type === STRAP && o.text === 'catch') {
|
|
69
|
+
o = o.next;
|
|
70
|
+
var arg = [];
|
|
71
|
+
if (o.type === SCOPED && o.entry === "(") {
|
|
72
|
+
var e = o.first;
|
|
73
|
+
if (e) {
|
|
74
|
+
arg = scanner2(`${e.text}=${ret_ || "@"};`);
|
|
75
|
+
}
|
|
76
|
+
o = o.next;
|
|
77
|
+
}
|
|
78
|
+
var ai = result.length;
|
|
79
|
+
unblock(o);
|
|
80
|
+
if (ai < result.length) {
|
|
81
|
+
if (arg.length) result[ai].unshift(...arg), result[ai].awaited = true, relink(result[ai]);
|
|
82
|
+
if (!result[result.length - 1].ret_) pushstep(result, stepReturn(0, 9));
|
|
75
83
|
}
|
|
76
84
|
o = o.next;
|
|
77
85
|
}
|
|
78
|
-
|
|
79
|
-
unblock(o);
|
|
80
|
-
if (ai < result.length) {
|
|
81
|
-
if (arg.length) result[ai].unshift(...arg), result[ai].awaited = true, relink(result[ai]);
|
|
82
|
-
if (!result[result.length - 1].ret_) pushstep(result, stepReturn(0, 9));
|
|
83
|
-
}
|
|
84
|
-
o = o.next;
|
|
86
|
+
else tse[2].text = '8';
|
|
85
87
|
var finishoffset = result.length;
|
|
86
88
|
if (o && o.type === STRAP && o.text === 'finally') {
|
|
87
89
|
o = o.next;
|
|
88
90
|
unblock(o);
|
|
91
|
+
o = o.next;
|
|
89
92
|
}
|
|
90
93
|
tse[0].text = String(catchoffset - tryoffset | finishoffset - catchoffset << 16);
|
|
91
94
|
var finalend = stepReturn(1, 9);
|
|
@@ -294,8 +297,10 @@ var pushstep = function (result, step) {
|
|
|
294
297
|
result.push(step);
|
|
295
298
|
}
|
|
296
299
|
else if (q.await_) {
|
|
297
|
-
if (!step.awaited)
|
|
298
|
-
|
|
300
|
+
if (!step.awaited) {
|
|
301
|
+
step.unshift(...scanner2(`${q.name}=${ret_};`)), relink(step);
|
|
302
|
+
step.awaited = true;
|
|
303
|
+
}
|
|
299
304
|
result.push(step);
|
|
300
305
|
}
|
|
301
306
|
else if (q.ret_) {
|
|
@@ -311,6 +316,7 @@ var pushstep = function (result, step) {
|
|
|
311
316
|
q.push(...step);
|
|
312
317
|
q.await_ = step.await_;
|
|
313
318
|
q.name = step.name;
|
|
319
|
+
q.skip = !!step.skip;
|
|
314
320
|
step = q;
|
|
315
321
|
relink(q);
|
|
316
322
|
}
|
|
@@ -391,7 +397,7 @@ var needbreak = function (o) {
|
|
|
391
397
|
var isretn = function (o) {
|
|
392
398
|
return o === RETURN || o === NEXT || o === YIELD || o === THROW;
|
|
393
399
|
}
|
|
394
|
-
var _return = function (r
|
|
400
|
+
var _return = function (r) {
|
|
395
401
|
var name = r.name;
|
|
396
402
|
var e = r[r.length - 1];
|
|
397
403
|
if (!isretn(e)) return;
|
|
@@ -401,12 +407,13 @@ var _return = function (r, nextindex) {
|
|
|
401
407
|
if (e === RETURN) {
|
|
402
408
|
x = stepReturn(name, 2);
|
|
403
409
|
}
|
|
404
|
-
else if (e === YIELD) {
|
|
405
|
-
x = stepReturn(name, 3);
|
|
406
|
-
}
|
|
407
410
|
else if (e === THROW) {
|
|
408
411
|
x = scanner2(`throw ${name}`);
|
|
409
412
|
}
|
|
413
|
+
else if (e === YIELD) {
|
|
414
|
+
x = stepReturn(name, 3);
|
|
415
|
+
r.await_ = !r.skip;
|
|
416
|
+
}
|
|
410
417
|
else if (e === NEXT) {
|
|
411
418
|
x = stepReturn(name, 1);
|
|
412
419
|
r.await_ = true;
|
|
@@ -462,12 +469,18 @@ var _invoke = function (t, getname) {
|
|
|
462
469
|
var bx = 0;
|
|
463
470
|
for (var cx = 0; cx < t.length; cx++) {
|
|
464
471
|
var o = t[cx];
|
|
465
|
-
if (o.type === STRAP
|
|
466
|
-
while (o && o.entry !== "{") o = o.next;
|
|
472
|
+
a: if (o.type === STRAP) {
|
|
473
|
+
if (/^(async|function)/.test(o.text)) while (o && o.entry !== "{") o = o.next;
|
|
474
|
+
else if (o.text === 'class') {
|
|
475
|
+
while (o && !o.isClass) o = o.next;
|
|
476
|
+
var n = o.next;
|
|
477
|
+
while (n && n.isClass) o = n, n = n.next;
|
|
478
|
+
}
|
|
479
|
+
else break a;
|
|
467
480
|
cx = t.indexOf(o, cx);
|
|
481
|
+
if (cx < 0) cx = t.length;
|
|
468
482
|
continue;
|
|
469
483
|
}
|
|
470
|
-
|
|
471
484
|
if (needbreak(o)) {
|
|
472
485
|
var s = splice(t, bx, cx + 1 - bx);
|
|
473
486
|
if (cx > 0) s.name = s[0].text;
|
|
@@ -558,9 +571,13 @@ var _invoke = function (t, getname) {
|
|
|
558
571
|
};
|
|
559
572
|
|
|
560
573
|
var _await = function (t) {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
574
|
+
var t0 = t[0];
|
|
575
|
+
if (t0.type === STRAP) {
|
|
576
|
+
var iw = 0;
|
|
577
|
+
if (t0.text === 'await') iw = 1;
|
|
578
|
+
else if (t0.text === 'yield') iw = 3;
|
|
579
|
+
if (iw) t.shift();
|
|
580
|
+
return iw;
|
|
564
581
|
}
|
|
565
582
|
return false;
|
|
566
583
|
};
|
|
@@ -638,6 +655,7 @@ var popexp = function (explist) {
|
|
|
638
655
|
}
|
|
639
656
|
return [asn, n];
|
|
640
657
|
}
|
|
658
|
+
|
|
641
659
|
var ternary = function (body, getname, ret) {
|
|
642
660
|
var eqused = 0;
|
|
643
661
|
var getnextname = function (i) {
|
|
@@ -777,6 +795,39 @@ var ternary = function (body, getname, ret) {
|
|
|
777
795
|
}
|
|
778
796
|
return explist;
|
|
779
797
|
};
|
|
798
|
+
var prefunc = function (sbody) {
|
|
799
|
+
var fx = 0;
|
|
800
|
+
for (var cx = 0, dx = sbody.length; cx < dx; cx++) {
|
|
801
|
+
var o = sbody[cx];
|
|
802
|
+
var bx = cx;
|
|
803
|
+
while (o && o.type & (SPACE | COMMENT)) o = sbody[++cx];
|
|
804
|
+
if (!o) break;
|
|
805
|
+
if (o.type === STRAP && /^(async|function|class)$/.test(o.text)) {
|
|
806
|
+
if (!o.isExpress) {
|
|
807
|
+
var ex = skipAssignment(sbody, cx);
|
|
808
|
+
var fname = '';
|
|
809
|
+
o = o.next;
|
|
810
|
+
while (o.type & (STRAP | STAMP)) o = o.next;
|
|
811
|
+
if (o.type === EXPRESS) fname = o.text;
|
|
812
|
+
if (fname) {
|
|
813
|
+
if (isHalfSentence(sbody, cx - 1)) {
|
|
814
|
+
splice(sbody, cx, 0, { type: EXPRESS, text: fname }, { type: STAMP, text: "=" });
|
|
815
|
+
}
|
|
816
|
+
else {
|
|
817
|
+
var sb = splice(sbody, bx, ex - bx);
|
|
818
|
+
splice(sbody, fx, 0, { type: EXPRESS, text: fname }, { type: STAMP, text: "=" }, ...sb);
|
|
819
|
+
fx += ex - bx + 2;
|
|
820
|
+
}
|
|
821
|
+
ex += 2;
|
|
822
|
+
dx += 2;
|
|
823
|
+
}
|
|
824
|
+
cx = ex;
|
|
825
|
+
continue;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
|
|
780
831
|
var isFunctionOnly = function (body) {
|
|
781
832
|
for (var cx = 2, dx = body.length; cx < dx; cx++) {
|
|
782
833
|
if (body[cx].type & (SPACE | COMMENT)) continue;
|
|
@@ -784,9 +835,14 @@ var isFunctionOnly = function (body) {
|
|
|
784
835
|
}
|
|
785
836
|
var o = body[cx];
|
|
786
837
|
if (!o) return false;
|
|
787
|
-
if (o.type === STRAP
|
|
788
|
-
while (o && o.entry !== "{") o = body[cx++];
|
|
789
|
-
if (
|
|
838
|
+
if (o.type === STRAP) {
|
|
839
|
+
if (/^(async|function)$/.test(o.text)) while (o && o.entry !== "{") o = body[cx++];
|
|
840
|
+
else if (o.text === 'class') {
|
|
841
|
+
while (o && !o.isClass) o = body[cx++];
|
|
842
|
+
while (o && (o.type & (SPACE | COMMENT) || o.isClass)) o = body[cx++];
|
|
843
|
+
}
|
|
844
|
+
else return false;
|
|
845
|
+
if (!o) return true;
|
|
790
846
|
}
|
|
791
847
|
else return false;
|
|
792
848
|
for (; cx < dx; cx++) {
|
|
@@ -861,8 +917,13 @@ var _express = function (body, getname, ret) {
|
|
|
861
917
|
for (; cx < dx; cx++) {
|
|
862
918
|
var o = body[cx];
|
|
863
919
|
if (o.type & (COMMENT | SPACE)) continue;
|
|
864
|
-
if (o.type === STRAP
|
|
865
|
-
while (o && (o.type !== SCOPED || o.entry !== '{')) o = body[++cx];
|
|
920
|
+
a: if (o.type === STRAP) {
|
|
921
|
+
if (/^(async|function)$/.test(o.text)) while (o && (o.type !== SCOPED || o.entry !== '{')) o = body[++cx];
|
|
922
|
+
else if (o.text === 'class') {
|
|
923
|
+
while (o && !o.isClass) o = body[++cx];
|
|
924
|
+
while (o && (o.type & (SPACE | COMMENT) || o.isClass)) o = body[++cx];
|
|
925
|
+
}
|
|
926
|
+
else break a;
|
|
866
927
|
continue;
|
|
867
928
|
}
|
|
868
929
|
if (o.type & (STRAP | STAMP)) {
|
|
@@ -887,13 +948,16 @@ var _express = function (body, getname, ret) {
|
|
|
887
948
|
if (needcomma(q)) q.push({ type: STAMP, text: ',' });
|
|
888
949
|
var p0 = cache.pop();
|
|
889
950
|
var t = cache.pop();
|
|
890
|
-
var
|
|
891
|
-
if (p0 > powermap["="] ||
|
|
951
|
+
var iw = _await(t);
|
|
952
|
+
if (p0 > powermap["="] || iw) q.push(...scanner2(`${getname(t.index)}=`));
|
|
892
953
|
q.push.apply(q, t);
|
|
893
954
|
q.push.apply(q, b);
|
|
894
955
|
b = scanner2(`${getname(t.index)}`);
|
|
895
956
|
nameindex = t.index;
|
|
896
|
-
if (
|
|
957
|
+
if (iw) {
|
|
958
|
+
if (iw === 1) q.push(NEXT);
|
|
959
|
+
else if (iw === 3) q.push(YIELD);
|
|
960
|
+
}
|
|
897
961
|
}
|
|
898
962
|
var name = getname(nameindex);
|
|
899
963
|
q.name = name;
|
|
@@ -932,15 +996,18 @@ var _express = function (body, getname, ret) {
|
|
|
932
996
|
if (needcomma(q)) q.push({ type: STAMP, text: ',' });
|
|
933
997
|
nameindex = cache[cache.length - 1].index;
|
|
934
998
|
var t = cache.pop();
|
|
935
|
-
var
|
|
999
|
+
var iw = _await(t, nameindex);
|
|
936
1000
|
if (!t.length && canbeTemp(b) && b[0].text === getname(nameindex)) {
|
|
937
1001
|
}
|
|
938
1002
|
else {
|
|
939
|
-
if (p > powermap["="] && (ret || cache.length > 0 ||
|
|
1003
|
+
if (p > powermap["="] && (ret || cache.length > 0 || iw)) q.push(...scanner2(`${getname(nameindex)}=`));
|
|
940
1004
|
q.push.apply(q, t);
|
|
941
1005
|
q.push.apply(q, b);
|
|
942
1006
|
}
|
|
943
|
-
if (
|
|
1007
|
+
if (iw) {
|
|
1008
|
+
if (iw === 1) q.push(NEXT);
|
|
1009
|
+
else if (iw === 3) q.push(YIELD);
|
|
1010
|
+
}
|
|
944
1011
|
needname = true;
|
|
945
1012
|
b = [{ type: EXPRESS, text: getname(nameindex) }];
|
|
946
1013
|
}
|
|
@@ -956,7 +1023,7 @@ var _express = function (body, getname, ret) {
|
|
|
956
1023
|
}
|
|
957
1024
|
if (needname) q.name = getname(nameindex);
|
|
958
1025
|
relink(q);
|
|
959
|
-
if (isFunctionOnly(q)) {
|
|
1026
|
+
if (isFunctionOnly(q, 2)) {
|
|
960
1027
|
result = [q];
|
|
961
1028
|
}
|
|
962
1029
|
else {
|
|
@@ -987,7 +1054,7 @@ var scopes = [null];
|
|
|
987
1054
|
var isbreak = function (o) {
|
|
988
1055
|
if (o.type !== STRAP) return false;
|
|
989
1056
|
return /^(break|continue)$/.test(o.text) ||
|
|
990
|
-
/^(
|
|
1057
|
+
/^(return)$/.test(o.text) && (o.isend || skipAssignment(o.next) === o.next.next && canbeTemp([o.next]));
|
|
991
1058
|
};
|
|
992
1059
|
|
|
993
1060
|
var ifpatch = function (result, autoskip) {
|
|
@@ -1021,6 +1088,7 @@ var poplabel = function (result) {
|
|
|
1021
1088
|
|
|
1022
1089
|
function toqueue(body, getname, ret = false, result = []) {
|
|
1023
1090
|
var retn = false;
|
|
1091
|
+
if (!ret) prefunc(body);
|
|
1024
1092
|
var uniftop = function () {
|
|
1025
1093
|
for (var cx = 4, dx = iftop.length; cx < dx; cx += 4) {
|
|
1026
1094
|
var isbr = iftop[cx - 3];
|
|
@@ -1044,8 +1112,8 @@ function toqueue(body, getname, ret = false, result = []) {
|
|
|
1044
1112
|
}
|
|
1045
1113
|
};
|
|
1046
1114
|
};
|
|
1047
|
-
var unblock = function (block) {
|
|
1048
|
-
toqueue(block, getname,
|
|
1115
|
+
var unblock = function (block, ret = true) {
|
|
1116
|
+
toqueue(block, getname, ret, result);
|
|
1049
1117
|
return result[result.length - 1];
|
|
1050
1118
|
};
|
|
1051
1119
|
var _poplabel = function () {
|
|
@@ -1053,9 +1121,10 @@ function toqueue(body, getname, ret = false, result = []) {
|
|
|
1053
1121
|
}
|
|
1054
1122
|
var cx = 0, bx = 0;
|
|
1055
1123
|
var iftop = null;
|
|
1056
|
-
var brk = function (text, YIELD) {
|
|
1124
|
+
var brk = function (text, YIELD, skip) {
|
|
1057
1125
|
if (o.text !== text) return;
|
|
1058
1126
|
retn = [YIELD];
|
|
1127
|
+
retn.skip = skip;
|
|
1059
1128
|
ret = true;
|
|
1060
1129
|
bx = ++cx;
|
|
1061
1130
|
return retn;
|
|
@@ -1096,12 +1165,12 @@ function toqueue(body, getname, ret = false, result = []) {
|
|
|
1096
1165
|
continue;
|
|
1097
1166
|
}
|
|
1098
1167
|
a: if (o.type === STRAP) {
|
|
1099
|
-
if (/^(new|typeof|await|
|
|
1168
|
+
if (/^(new|typeof|delete|await|void|debugger)$/.test(o.text)) {
|
|
1100
1169
|
break a;
|
|
1101
1170
|
}
|
|
1102
|
-
if (brk("yield", YIELD)) break a;
|
|
1103
|
-
if (brk("return", RETURN)) break a;
|
|
1104
|
-
if (brk("throw", THROW)) break a;
|
|
1171
|
+
if (brk("yield", YIELD, skipAssignment)) break a;
|
|
1172
|
+
if (brk("return", RETURN, skipSentenceQueue)) break a;
|
|
1173
|
+
if (brk("throw", THROW, skipSentenceQueue)) break a;
|
|
1105
1174
|
if (/^(async|function|class)$/.test(o.text)) {
|
|
1106
1175
|
// cx = skipAssignment(body, cx);
|
|
1107
1176
|
// var f = body.slice(bx, cx);
|
|
@@ -1211,13 +1280,27 @@ function toqueue(body, getname, ret = false, result = []) {
|
|
|
1211
1280
|
bx = cx;
|
|
1212
1281
|
continue;
|
|
1213
1282
|
}
|
|
1214
|
-
|
|
1283
|
+
if (retn && retn.skip) {
|
|
1284
|
+
o = retn.skip(o);
|
|
1285
|
+
cx = body.indexOf(o, cx);
|
|
1286
|
+
if (cx < 0) cx = body.length;
|
|
1287
|
+
}
|
|
1288
|
+
else cx = skipAssignment(body, cx);
|
|
1215
1289
|
var b = body.slice(bx, cx);
|
|
1216
|
-
bx =
|
|
1217
|
-
|
|
1218
|
-
for (
|
|
1290
|
+
bx = cx
|
|
1291
|
+
var a = null;
|
|
1292
|
+
for (b of createExpressList(b)) {
|
|
1293
|
+
if (isempty(b, SPACE | COMMENT)) {
|
|
1294
|
+
if (a) b.name = a.name;
|
|
1295
|
+
a = b;
|
|
1296
|
+
pushstep(result, a);
|
|
1297
|
+
continue;
|
|
1298
|
+
}
|
|
1299
|
+
b = ternary(b, getname, ret);
|
|
1300
|
+
for (a of b) pushstep(result, a);
|
|
1301
|
+
}
|
|
1219
1302
|
if (retn) {
|
|
1220
|
-
if (
|
|
1303
|
+
if (a) retn.name = a.name;
|
|
1221
1304
|
pushstep(result, retn);
|
|
1222
1305
|
}
|
|
1223
1306
|
else {
|
|
@@ -38,6 +38,8 @@ test("await a", "_ = a; return [_, 1]", true);
|
|
|
38
38
|
test("yield a", "return [a, 3]", true);
|
|
39
39
|
test("await a()", "_ = a(); return [_, 1]", true);
|
|
40
40
|
test("yield a()", "_ = a(); return [_, 3]", true);
|
|
41
|
+
test("a = await a()", "_ = a(); return [_, 1];\r\n _ = @; a = _", true);
|
|
42
|
+
test("a = yield a()", "_ = a(); return [_, 3];\r\n _ = @; a = _", true);
|
|
41
43
|
test("(1+ +1)", "_ = +1, _ = 1 + _; (_)", true);
|
|
42
44
|
test("await a(await b)", "_ = b; return [_, 1];\r\n _ = @; _ = a(_); return [_, 1]", true);
|
|
43
45
|
test("await a(await b).s(await c)", "_ = b; return [_, 1];\r\n _ = @; _ = a(_); _0 = c; return [_0, 1];\r\n _0 = @; _ = _.s(_0); return [_, 1]", true);
|
|
@@ -81,7 +83,14 @@ test("try{a=2+1}catch(e){}", 'return [1, 7];\r\n a = 2 + 1; return [0, 9];\r\n r
|
|
|
81
83
|
test("try{a=2+1}catch(e){a=3}", 'return [65537, 7];\r\n a = 2 + 1; return [0, 9];\r\n e = @; a = 3; return [0, 9];\r\n return [1, 9]', true);
|
|
82
84
|
test("(function(){})", '_ = function () {}; (_)', true);
|
|
83
85
|
test("(1+2*function(){}())", '_ = 2 * function () {}(), _ = 1 + _; (_)', true);
|
|
84
|
-
test("function a(){}", 'function a() {}', true);
|
|
86
|
+
test("function a(){}", 'a = function a() {}', true);
|
|
87
|
+
test("if(1) function a(){}", 'if (false) return [1, 0]; a = function a() {}; return [1, 0]', true);
|
|
88
|
+
test("if(1) {function a(){}}", 'if (false) return [1, 0]; a = function a() {}; return [1, 0]', true);
|
|
89
|
+
test("if(a) a = 1;function a(){}", "a = function a() {}; if (!a) return [1, 0]; a = 1; return [1, 0]", true);
|
|
90
|
+
test("if(a) a = 1;async function a(){}", "a = async function a() {}; if (!a) return [1, 0]; a = 1; return [1, 0]", true);
|
|
91
|
+
test("if(a) a = 1;async function* a(){}", "a = async function* a() {}; if (!a) return [1, 0]; a = 1; return [1, 0]", true);
|
|
92
|
+
test("if(a) a = 1;class a{}", "a = class a{}; if (!a) return [1, 0]; a = 1; return [1, 0]", true);
|
|
93
|
+
test("if(a) a = 1;function* a(){}", "a = function* a() {}; if (!a) return [1, 0]; a = 1; return [1, 0]", true);
|
|
85
94
|
test("await new Promise(function(){})", '_ = function () {}; _ = new Promise(_); return [_, 1]', true);
|
|
86
95
|
test(`onerror({ status: xhr.status, response: "Cookie解析异常!", toString: toResponse })`, '_ = { status: xhr.status, response: "Cookie解析异常!", toString: toResponse }; onerror(_)', true);
|
|
87
96
|
test(`if (!/^https\\:\\/\\/|^s\\/\\//.test(url)) console.warn("请使用https访问如下路径:" + url)`, '_ = /^https\\:\\/\\/|^s\\/\\//.test(url); if (_) return [1, 0]; _ = "请使用https访问如下路径:" + url; _ = console.warn(_); return [1, 0]', true);
|
|
@@ -92,8 +101,11 @@ test(`location.protocol + parseURL(a.b).host `, `_ = a.b; _ = parseURL(_); loca
|
|
|
92
101
|
test(`var base = location.protocol + "//" + parseURL(this.$scope.data.host).host + "/";`, `_ = location.protocol + "//", _0 = this.$scope.data.host; _0 = parseURL(_0); _ = _ + _0.host, base = _ + "/"`, true);
|
|
93
102
|
test(`a=a+b*c+c*d`, `_ = b * c, _ = a + _, _0 = c * d, a = _ + _0`, true);
|
|
94
103
|
test(`cc.name += "<f test></f>"`, `_ = cc.name + "<f test></f>"; cc.name = _`, true);
|
|
95
|
-
test("yield a", 'return [a, 3]', true);
|
|
96
104
|
test("throw a", 'throw a', true);
|
|
105
|
+
test("throw a,b", 'a; throw b', true);
|
|
106
|
+
test("return a,b", 'a; return [b, 2]', true);
|
|
107
|
+
test("return a\r\n", 'return [a, 2]', true);
|
|
108
|
+
test("return a\r\n+b/*c*/;", '_ = a\r\n+ b; /*c*/ return [_, 2]', true);
|
|
97
109
|
test("debugger", 'debugger', true);
|
|
98
110
|
test("a(b,b+=1)", '_ = b; _0 = b + 1; b = _0; a(_, _0)', true);
|
|
99
111
|
test("while(a){if(b){if(c);else d;continue;}}", 'if (!a) return [4, 0]; if (!b) return [3, 0]; if (!c) return [1, 0]; return [2, 0];\r\n d; return [1, 0];\r\n return [-2, 0];\r\n return [-3, 0]', true);
|