efront 3.36.5 → 3.36.6
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_/async_.js +62 -0
- package/coms/basic_/async_test.js +11 -0
- package/coms/compile/Program.js +1 -1
- package/coms/compile/common.js +5 -0
- package/coms/compile/createExpressList_test.js +19 -0
- package/coms/compile/downLevel.js +103 -13
- package/coms/compile/downLevel_test.js +10 -6
- package/coms/compile/powermap.js +12 -0
- package/coms/compile/unstruct.js +241 -161
- package/coms/compile/unstruct_test.js +41 -34
- package/coms/zimoli/alert.js +1 -1
- package/coms/zimoli/cless.js +1 -1
- package/coms/zimoli/menuItem.html +1 -1
- package/coms/zimoli/menuItem.js +1 -1
- package/package.json +1 -1
- package/public/efront.js +1 -1
|
@@ -4,10 +4,9 @@ var { createString } = require("./common");
|
|
|
4
4
|
function test(codetext, expect, ret = false) {
|
|
5
5
|
var code = scanner2(codetext);
|
|
6
6
|
var i = -2;
|
|
7
|
-
code = unstruct(code, () => ++i >= 0 ? "_" + i : '_', ret);
|
|
7
|
+
code = unstruct(code, () => ++i >= 0 ? "_" + i : '_', ret && "@");
|
|
8
8
|
assert(code.map(createString).join("; "), expect);
|
|
9
9
|
}
|
|
10
|
-
|
|
11
10
|
test('a+b', "a + b");
|
|
12
11
|
test('a + !c', "_ = !c, a + _");
|
|
13
12
|
test('a + b * c', "_ = b * c, a + _");
|
|
@@ -17,38 +16,46 @@ test('a * a + b * c', "_ = a * a, _0 = b * c, _ + _0");
|
|
|
17
16
|
test('a * a + b * c * c ** d', "_ = a * a, _0 = b * c, _1 = c ** d, _0 = _0 * _1, _ + _0");
|
|
18
17
|
test('a * a || b * c * c ** d', "_ = a * a @re _ = b * c, _0 = c ** d, _ * _0");
|
|
19
18
|
test('a * a || b * c || c * d', "_ = a * a @re _ = b * c @re c * d");
|
|
20
|
-
test('a?b:c', "_ = a; return [_ ? 1 : 2,
|
|
19
|
+
test('a?b:c', "_ = a; return [_ ? 1 : 2, 0]; _ = b; return [2, 0]; _ = c");
|
|
21
20
|
test('a * a && b * c * c ** d', "_ = a * a @rz _ = b * c, _0 = c ** d, _ * _0");
|
|
22
|
-
test('a =
|
|
23
|
-
test('a = b
|
|
24
|
-
test('a = b = c
|
|
25
|
-
test('a = b = c + d
|
|
26
|
-
test('
|
|
27
|
-
test('a
|
|
28
|
-
test('a
|
|
21
|
+
test('a = 1 + 2', "_ = 1 + 2, a = _", true);
|
|
22
|
+
test('a = b', "a = b", true);
|
|
23
|
+
test('a = b = c', "_ = c, b = _, a = _", true);
|
|
24
|
+
test('a = b = c + d', "_ = c + d, b = _, a = _", true);
|
|
25
|
+
test('a = b = c + d * 1', "_ = d * 1, _ = c + _, b = _, a = _", true);
|
|
26
|
+
test('return a = b', "a = b; return [a, 2]", true);
|
|
27
|
+
test('a*a', "_ = a * a", true);
|
|
28
|
+
test('a * a && b * c * c ** d', "_ = a * a; if (!_) return [1, 0]; _ = b * c, _0 = c ** d, _ = _ * _0", true);
|
|
29
|
+
test('a * a || b * c * c ** d', "_ = a * a; if (_) return [1, 0]; _ = b * c, _0 = c ** d, _ = _ * _0", true);
|
|
30
|
+
test('a * a ?? b * c * c ** d', "_ = a * a; if (_ !== null && _ !== undefined) return [1, 0]; _ = b * c, _0 = c ** d, _ = _ * _0", true);
|
|
31
|
+
test('a * a && await b*c', "_ = a * a; if (!_) return [2, 0]; _ = b; return [_, 1]; _ = @; _ = _ * c", true);
|
|
29
32
|
|
|
30
|
-
test("await a", "_ = a; return [
|
|
31
|
-
test("await a()", "_ = a(); return [
|
|
32
|
-
test("(1+ +1)", "_ = +1
|
|
33
|
-
test("await a(await b)", "_ = b; return [
|
|
34
|
-
test("await a(await b).s(await c)", "_ = b; return [
|
|
35
|
-
test("a*a + await a(await b).s(await c)", "_ = a * a; _0 = b; return [
|
|
36
|
-
test("a*a + await a(await b(await c)).s(await c)", "_ = a * a; _0 = c; return [
|
|
37
|
-
test("await a, await b", "_ = a; return [
|
|
38
|
-
test("await a * b, await b", "_ = a; return [
|
|
39
|
-
test("if(a)
|
|
40
|
-
test("if(a) await b
|
|
41
|
-
test("if(a) await b; else
|
|
42
|
-
test("if(a)
|
|
43
|
-
test("if(await
|
|
44
|
-
test("
|
|
45
|
-
test("
|
|
46
|
-
test("
|
|
47
|
-
test("
|
|
48
|
-
test("
|
|
49
|
-
test("
|
|
50
|
-
test("switch(a){case 1:
|
|
51
|
-
test("switch(a){case 1:
|
|
52
|
-
test("switch(a){case 1:case 2:
|
|
53
|
-
test("switch(a){case 1:case 2:
|
|
33
|
+
test("await a", "_ = a; return [_, 1]", true);
|
|
34
|
+
test("await a()", "_ = a(); return [_, 1]", true);
|
|
35
|
+
test("(1+ +1)", "_ = +1, _ = 1 + _; _ = (_)", true);
|
|
36
|
+
test("await a(await b)", "_ = b; return [_, 1]; _ = @; _ = a(_); return [_, 1]", true);
|
|
37
|
+
test("await a(await b).s(await c)", "_ = b; return [_, 1]; _ = @; _ = a(_); _0 = c; return [_0, 1]; _0 = @; _ = _.s(_0); return [_, 1]", true);
|
|
38
|
+
test("a*a + await a(await b).s(await c)", "_ = a * a; _0 = b; return [_0, 1]; _0 = @; _0 = a(_0); _1 = c; return [_1, 1]; _1 = @; _0 = _0.s(_1); return [_0, 1]; _0 = @; _ = _ + _0", true);
|
|
39
|
+
test("a*a + await a(await b(await c)).s(await c)", "_ = a * a; _0 = c; return [_0, 1]; _0 = @; _0 = b(_0); return [_0, 1]; _0 = @; _0 = a(_0); _1 = c; return [_1, 1]; _1 = @; _0 = _0.s(_1); return [_0, 1]; _0 = @; _ = _ + _0", true);
|
|
40
|
+
test("await a, await b", "_ = a; return [_, 1]; _ = b; return [_, 1]", true);
|
|
41
|
+
test("await a * b, await b", "_ = a; return [_, 1]; _ = @; _ = _ * b; _ = b; return [_, 1]", true);
|
|
42
|
+
test("if(a);", "", true);
|
|
43
|
+
test("if(a) await b", "if (!a) return [1, 0]; _ = b; return [_, 1]", true);
|
|
44
|
+
test("if(a) await b; else await c", "if (!a) return [2, 0]; _ = b; return [_, 1]; return [2, 0]; _ = c; return [_, 1]", true);
|
|
45
|
+
test("if(a) b; else await c", "if (!a) return [1, 0]; _ = b; return [2, 0]; _ = c; return [_, 1]", true);
|
|
46
|
+
test("if(a) await b; else if(e) await c", "if (!a) return [2, 0]; _ = b; return [_, 1]; return [2, 0]; if (!e) return [1, 0]; _ = c; return [_, 1]", true);
|
|
47
|
+
test("if(a) await b; else if(e) await c else await d", "if (!a) return [2, 0]; _ = b; return [_, 1]; return [4, 0]; if (!e) return [2, 0]; _ = c; return [_, 1]; return [2, 0]; _ = d; return [_, 1]", true);
|
|
48
|
+
test("if(await a) await b", "_ = a; return [_, 1]; if (!_) return [1, 0]; _ = b; return [_, 1]", true);
|
|
49
|
+
test("for(a=0;a<10;a++) await a", "a = 0; return [1, 0]; _ = a < 10; if (!_) return [3, 0]; _ = a; return [_, 1]; _ = a++; return [-2, 0]", true);
|
|
50
|
+
test("for(a=0;a<10;a++) await a, await b", "a = 0; return [1, 0]; _ = a < 10; if (!_) return [4, 0]; _ = a; return [_, 1]; _ = b; return [_, 1]; _ = a++; return [-3, 0]", true);
|
|
51
|
+
test("while(a) await b", "_ = a; if (!_) return [3, 0]; _ = b; return [_, 1]; return [-2, 0]", true);
|
|
52
|
+
test("do{await b}while(a)", "_ = b; return [_, 1]; _ = a; return [_ ? -2 : 1, 0]", true);
|
|
53
|
+
test("switch(a){case 1:}", "_ = a; _0 = 1; if (_ === _0) return [1, 0]", true);
|
|
54
|
+
test("switch(a){case 1:break;}", "_ = a; _0 = 1; if (_ === _0) return [1, 0]; return [1, 0]", true);
|
|
55
|
+
test("switch(a){case 1:break;case 2:break;}", "_ = a; _0 = 1; if (_ === _0) return [1, 0]; _0 = 2; if (_ === _0) return [2, 0]; return [2, 0]; return [1, 0]", true);
|
|
56
|
+
test("switch(a){case 1:case 2:break;}", "_ = a; _0 = 1; if (_ === _0) return [1, 0]; _0 = 2; if (_ === _0) return [1, 0]; return [1, 0]", true);
|
|
57
|
+
test("switch(a){case 1:case 2:x=1;}", "_ = a; _0 = 1; if (_ === _0) return [1, 0]; _0 = 2; if (_ === _0) return [1, 0]; x = 1", true);
|
|
58
|
+
test("switch(a){case 1:case 2:x=1;}", "_ = a; _0 = 1; if (_ === _0) return [1, 0]; _0 = 2; if (_ === _0) return [1, 0]; x = 1", true);
|
|
54
59
|
test("with(a){ a = 1}", `_ = a; if (_0 = with_("a", [_])) _0.a = 1; else a = 1;`, true);
|
|
60
|
+
test("try{a=2+1}catch(e){}", 'return [65536, 7]; _ = 2 + 1, a = _; return [0, 9]; e = @; return [1, 9]', true);
|
|
61
|
+
test("try{a=2+1}catch(e){a=3}", 'return [65536, 7]; _ = 2 + 1, a = _; return [0, 9]; e = @; a = 3; return [1, 9]', true);
|
package/coms/zimoli/alert.js
CHANGED
package/coms/zimoli/cless.js
CHANGED
package/coms/zimoli/menuItem.js
CHANGED
|
@@ -19,7 +19,7 @@ function main(elem, scope, hasIcon) {
|
|
|
19
19
|
menu,
|
|
20
20
|
checker,
|
|
21
21
|
};
|
|
22
|
-
if (hasIcon) scope.hasIcon = true;
|
|
22
|
+
if (hasIcon || menu.icon) scope.hasIcon = true;
|
|
23
23
|
render(item.children, scope);
|
|
24
24
|
if (menu.line) item.setAttribute("line", ''), on("click")(item, preventDefault);
|
|
25
25
|
return item;
|