efront 4.4.5 → 4.4.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.
@@ -608,7 +608,7 @@ var _invoke = function (t, getname) {
608
608
  }
609
609
  }
610
610
  if (queue.length) {
611
- queue.push(t);
611
+ if (t.length) queue.push(t);
612
612
  flushqueue(result, queue);
613
613
  }
614
614
  else if (t.length) {
@@ -617,6 +617,7 @@ var _invoke = function (t, getname) {
617
617
  t.unshift(...rescan(`${qname}=${qname}`));
618
618
  relink(t);
619
619
  }
620
+ t = uncurve(t);
620
621
  pushstep(result, t);
621
622
  }
622
623
  if (ret_) patchresult(result, 0);
@@ -704,7 +705,10 @@ var popexp = function (explist) {
704
705
  }
705
706
  return [asn, n];
706
707
  }
707
-
708
+ var uncurve = function (c) {
709
+ if (c.length === 1 && c[0].type === SCOPED && c[0].entry === '(' && canbeOnce(c[0])) c = c[0];
710
+ return c;
711
+ };
708
712
  var ternary = function (body, getname, ret) {
709
713
  var eqused = 0;
710
714
  var getnextname = function (i) {
@@ -787,7 +791,6 @@ var ternary = function (body, getname, ret) {
787
791
  explist = [r];
788
792
  }
789
793
  else {
790
- if (equals.length && bd.length === 1 && bd[0].type === SCOPED && bd[0].entry === '(' && skipAssignment(bd[0], 0) === bd[0].length) bd = bd[0];
791
794
  explist = _express(bd, getnextname, equalsend > skip || ret);
792
795
  }
793
796
  }
@@ -840,6 +843,7 @@ var ternary = function (body, getname, ret) {
840
843
  eq.text = "=";
841
844
  }
842
845
  else an = n;
846
+ asn = uncurve(asn);
843
847
  ass.push(equals[i], ...asn);
844
848
  relink(ass);
845
849
  if (evals.length) ass[0].set = getnextname(0);
@@ -39,13 +39,13 @@ test('a * a ?? b * c * c ** d', "_ = a * a; if (_ !== null && _ !== undefined) r
39
39
  test('a * a && await b*c', "_ = a * a; if (!_) return [2, 0]; _ = b; return [_, 1];\r\n _ = @; _ * c", true);
40
40
  test("await a", "_ = a; return [_, 1]", true);
41
41
  test("yield a", "return [a, 3]", true);
42
- test("!a.done&&(b=await a.value)", "_ = !a.done; if (!_) return [2, 0]; _ = a.value; return [_, 1];\r\n _ = @; b = _; (_)", true);
42
+ test("!a.done&&(b=await a.value)", "_ = !a.done; if (!_) return [2, 0]; _ = a.value; return [_, 1];\r\n _ = @; b = _; _", true);
43
43
  test("a=1?2:3", `if (false) return [1, 0]; a = 2; return [2, 0];\r\n a = 3; return [1, 0]`)
44
44
  test("await a()", "_ = a(); return [_, 1]", true);
45
45
  test("yield a()", "_ = a(); return [_, 3]", true);
46
46
  test("a = await a()", "_ = a(); return [_, 1];\r\n _ = @; a = _", true);
47
47
  test("a = yield a()", "_ = a(); return [_, 3];\r\n _ = @; a = _", true);
48
- test("(1+ +1)", "_ = 1 + +1; (_)", true);
48
+ test("(1+ +1)", "_ = 1 + +1; _", true);
49
49
  test("await a(await b)", "_ = b; return [_, 1];\r\n _ = @; _ = a(_); return [_, 1]", true);
50
50
  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);
51
51
  test("a*a + await a(await b).s(await c)", "_ = a * a, _0 = b; return [_0, 1];\r\n _0 = @; _0 = a(_0); _1 = c; return [_1, 1];\r\n _1 = @; _0 = _0.s(_1); return [_0, 1];\r\n _0 = @; _ + _0", true);
@@ -89,8 +89,8 @@ test("with(a){ a = 1}", `if (_ = with_("a", [a])) _.a = 1; else a = 1;`, true);
89
89
  test("try{a=2+1}catch(e){return;}", 'return [65537, 7];\r\n a = 2 + 1; return [0, 9];\r\n e = @; return [undefined, 2];\r\n return [1, 9]', true);
90
90
  test("try{a=2+1}catch(e){}", 'return [1, 7];\r\n a = 2 + 1; return [0, 9];\r\n return [1, 9]', true);
91
91
  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);
92
- test("(function(){})", '_ = function () {}; (_)', true);
93
- test("(1+2*function(){}())", '_ = 2 * function () {}(), _ = 1 + _; (_)', true);
92
+ test("(function(){})", '_ = function () {}; _', true);
93
+ test("(1+2*function(){}())", '_ = 2 * function () {}(), _ = 1 + _; _', true);
94
94
  test("function a(){}", 'a = function a() {}', true);
95
95
  test("if(1) function a(){}", 'if (false) return [1, 0]; a = function a() {}; return [1, 0]', true);
96
96
  test("if(1) {function a(){}}", 'if (false) return [1, 0]; a = function a() {}; return [1, 0]', true);
@@ -153,3 +153,4 @@ test(`c=b+ !a`, "_ = !a, c = b + _");
153
153
  test(`do {var loadcount = 0;} while (loadcount !== 0);`, `loadcount = 0; _ = loadcount !== 0; if (_) return [0, 0]`);
154
154
  unstruct.debug = true; r++;
155
155
  test("if(a)try{a}catch{};a;", 'if (!a) return [4, 0]; return [1, 7];\r\n a; return [0, 9];\r\n return [1, 9];\r\n return [1, 0];\r\n a');
156
+ test("url = (o===void 0||o===null?void 0:o.url)", '_ = void 0, _ = o === _; if (_) return [1, 0]; _ = o === null;\r\n if (!_) return [1, 0]; _ = void 0; return [2, 0];\r\n _ = o.url; return [1, 0];\r\n url = _', true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.4.5",
3
+ "version": "4.4.6",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {