efront 4.0.8 → 4.0.10
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/compile/unstruct.js
CHANGED
|
@@ -8,7 +8,8 @@ var THROW = { type: STRAP, text: "@throw" };// return;
|
|
|
8
8
|
var YIELD = { type: STRAP, text: "@yield" };// return;
|
|
9
9
|
var NEXT = { type: STRAP, text: "@next" };// return;
|
|
10
10
|
var _break = function (body, cx, result, iscontinue) {
|
|
11
|
-
|
|
11
|
+
var re = result[result.length - 1];
|
|
12
|
+
if (!result.length || re.ret_ && !re.await_ && re.ret_ !== -2) return;
|
|
12
13
|
var label;
|
|
13
14
|
do {
|
|
14
15
|
var o = body[++cx];
|
|
@@ -37,7 +38,7 @@ var _break = function (body, cx, result, iscontinue) {
|
|
|
37
38
|
else {
|
|
38
39
|
for (var cx = labels.length - 1; cx >= 0; cx--) {
|
|
39
40
|
var b = labels[cx];
|
|
40
|
-
if (b.type !== LABEL) {
|
|
41
|
+
if (b.type !== LABEL && (!iscontinue || b.text !== 'switch')) {
|
|
41
42
|
if (!b.breaks) b.breaks = [];
|
|
42
43
|
var _b = scanner2("return []");
|
|
43
44
|
_b.ret_ = -1;
|
|
@@ -441,7 +442,7 @@ var isEvalScope = function (o) {
|
|
|
441
442
|
return false;
|
|
442
443
|
}
|
|
443
444
|
var _invoke = function (t, getname) {
|
|
444
|
-
var nameindex = 0
|
|
445
|
+
var nameindex = 0;
|
|
445
446
|
var getdeepname = function (deep = 0) {
|
|
446
447
|
return getname(nameindex + deep)
|
|
447
448
|
};
|
|
@@ -472,6 +473,7 @@ var _invoke = function (t, getname) {
|
|
|
472
473
|
while (cy < o.length && o[cy].type & (SPACE | COMMENT)) cy++;
|
|
473
474
|
var ay = cy;
|
|
474
475
|
cy = skipAssignment(o, cy);
|
|
476
|
+
if (cy === ay || ay >= o.length) continue;
|
|
475
477
|
var m = o[ay];
|
|
476
478
|
if (cy === ay + 1 && (m.type === EXPRESS && !/[\.\[]/.test(m.text) || m.type === VALUE || m.type === QUOTED && !m.length)) {
|
|
477
479
|
continue;
|
|
@@ -94,4 +94,5 @@ test(`cc.name += "<f test></f>"`, `_ = cc.name + "<f test></f>"; cc.name = _`, t
|
|
|
94
94
|
test("yield a", 'return [a, 3]', true);
|
|
95
95
|
test("throw a", 'throw a', true);
|
|
96
96
|
test("debugger", 'debugger', true);
|
|
97
|
-
test("a(b,b+=1)", '_ = b; _0 = b + 1; b = _0; a(_, _0)', true);
|
|
97
|
+
test("a(b,b+=1)", '_ = b; _0 = b + 1; b = _0; a(_, _0)', true);
|
|
98
|
+
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);
|