efront 4.2.6 → 4.2.7
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
|
@@ -1266,8 +1266,9 @@ function toqueue(body, getname, ret = false, result = []) {
|
|
|
1266
1266
|
if (o.text === 'else') {
|
|
1267
1267
|
while (body[cx] !== o.next) cx++;
|
|
1268
1268
|
o = o.next;
|
|
1269
|
+
var ispbr = iftop[iftop.length - 3];
|
|
1270
|
+
if (!ispbr) ifpatch(result, true);
|
|
1269
1271
|
isbr = isbreak(o);
|
|
1270
|
-
if (!isbr) ifpatch(result, true);
|
|
1271
1272
|
iftop.push(result.length);
|
|
1272
1273
|
elseif = true;
|
|
1273
1274
|
}
|
|
@@ -69,7 +69,7 @@ test("for(a in b)", "for (a in b)", true);
|
|
|
69
69
|
test("for(a of b)", "for (a of b)", true);
|
|
70
70
|
test("for await(a of b)", "for await (a of b)", true);
|
|
71
71
|
test("for(a = os[Symbol.iterator] || os[Symbol.asyncIterator] || Array.prototype[Symbol.iterator], a = a.call(os), b = a.next(); !b.done && (o = b.value, true); b = a.next())", "_ = Symbol.iterator; _ = os[_]; if (_) return [1, 0]; _ = Symbol.asyncIterator; _ = os[_]; if (_) return [1, 0]; _ = Symbol.iterator; _ = Array.prototype[_];\r\n a = _; a = a.call(os); b = a.next(); return [1, 0];\r\n _ = !b.done; if (!_) return [1, 0]; o = b.value; _ = (true);\r\n if (!_) return [1, 0]; b = a.next(); return [-1, 0]", true);
|
|
72
|
-
test("for(a=0;a<1;a++)if(a==0)continue\r\n else a=1", `a = 0; return [1, 0];\r\n _ = a < 1; if (!_) return [
|
|
72
|
+
test("for(a=0;a<1;a++)if(a==0)continue\r\n else a=1", `a = 0; return [1, 0];\r\n _ = a < 1; if (!_) return [2, 0]; _ = a == 0; if (_) return [1, 0]; a = 1; return [1, 0];\r\n _ = a++; return [-1, 0]`, true);
|
|
73
73
|
test("for(a=0;a<1;a++)if(a==0){continue} else {a=1}", `a = 0; return [1, 0];\r\n _ = a < 1; if (!_) return [3, 0]; _ = a == 0; if (!_) return [1, 0]; return [2, 0];\r\n a = 1; return [1, 0];\r\n _ = a++; return [-2, 0]`, true);
|
|
74
74
|
test("for(a=0;a<1;a++){if(a==0){a=2;continue} else if(b) {a=1;continue} c=3}", `a = 0; return [1, 0];\r\n _ = a < 1; if (!_) return [4, 0]; _ = a == 0; if (!_) return [1, 0]; a = 2; return [3, 0];\r\n if (!b) return [1, 0]; a = 1; return [2, 0];\r\n c = 3; return [1, 0];\r\n _ = a++; return [-3, 0]`, true);
|
|
75
75
|
test("for(a=0;a<10;a++) await a", "a = 0; return [1, 0];\r\n _ = a < 10; if (!_) return [2, 0]; _ = a; return [_, 1];\r\n _ = @; _ = a++; return [-1, 0]", true);
|
|
@@ -134,4 +134,5 @@ test("[key[1]][key[2]][key[3]]", '_ = key[1]; _ = [_]; _0 = key[2]; _ = _[_0]; _
|
|
|
134
134
|
test("[key[1]][key[2]]+[key[3]][key[4]]", '_ = key[1]; _ = [_]; _0 = key[2]; _ = _[_0]; _0 = key[3]; _0 = [_0]; _1 = key[4]; _ + _0[_1]');
|
|
135
135
|
test("if(a)a:{break a}", "if (!a) return [2, 0]; return [1, 0];\r\n return [1, 0]", true);
|
|
136
136
|
unstruct.debug = true;
|
|
137
|
-
test("rgb=(rgb<<8|rgb>>16)&0xffffff", "_ = rgb << 8, _0 = rgb >> 16, _ = _ | _0; _ = (_); rgb = _ & 0xffffff", true);
|
|
137
|
+
test("rgb=(rgb<<8|rgb>>16)&0xffffff", "_ = rgb << 8, _0 = rgb >> 16, _ = _ | _0; _ = (_); rgb = _ & 0xffffff", true);
|
|
138
|
+
test(`if (c) a; else return true; return false`, "if (!c) return [1, 0]; a; return [2, 0];\r\n return [true, 2];\r\n return [false, 2]")
|