efront 4.11.6 → 4.12.0

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.
@@ -8,7 +8,7 @@
8
8
  <field -repeat="f in fields" -src="[f,data]"></field>
9
9
  </div>
10
10
  <div class="left">
11
- <pre -text="task.code"></pre>
11
+ <jscode -value="task.code" type="js"></jscode>
12
12
  </div>
13
13
  <div class="right" :class="{error:error}">
14
14
  <pre -text="output"></pre>
@@ -16,6 +16,7 @@ function main(a) {
16
16
  task: a,
17
17
  output: '',
18
18
  error: false,
19
+ jscode: 茨菰$编辑框,
19
20
  async run() {
20
21
  var id = ++taskid;
21
22
  this.output = "正在执行..";
@@ -2,16 +2,19 @@
2
2
  position: absolute;
3
3
  width: 800px;
4
4
  }
5
- >[body]{
6
- border-top: 50px solid transparent;
7
- border-bottom: 50px solid transparent;
8
- }
5
+
6
+
9
7
  >[body]>div {
10
8
  display: inline-block;
11
9
  vertical-align: top;
12
10
  overflow: auto;
13
11
  font-size: 12px;
14
12
 
13
+ >jscode,
14
+ >pre {
15
+ height: 100%;
16
+ }
17
+
15
18
  &.top {
16
19
  left: 0;
17
20
  top: 0;
@@ -403,7 +403,7 @@ var patchstep = function (r, nextindex, h) {
403
403
  x = rescan`if (${name}) return [${nextindex}, 0]`;
404
404
  }
405
405
  else if (o === RD) {
406
- x = rescan`if (${name}!= null) return [${nextindex}, 0]`;
406
+ x = rescan`if (${name}!=null) return [${nextindex}, 0]`;
407
407
  }
408
408
  else continue;
409
409
  changed = true;
@@ -941,6 +941,13 @@ var _express = function (body, getname, ret) {
941
941
  q.name = cloneNode(body);
942
942
  return [q];
943
943
  }
944
+ if (isFunctionOnly(body)) {
945
+ result = [body];
946
+ return result;
947
+ }
948
+ else {
949
+ result = [];
950
+ }
944
951
  var result = [];
945
952
  var q = [];
946
953
  var bx = 0;
@@ -949,6 +956,7 @@ var _express = function (body, getname, ret) {
949
956
  var nameindex = 0;
950
957
  var maxindex = 0;
951
958
  var hasor = false;
959
+ var xorcount = 0;
952
960
  var getdeepname = function (deep = 0) {
953
961
  return getname(maxindex + deep);
954
962
  };
@@ -1007,12 +1015,20 @@ var _express = function (body, getname, ret) {
1007
1015
  q.name = cloneNode(name);
1008
1016
  if (isor) {
1009
1017
  if (o.text === '||') {
1018
+ if (xorcount) {
1019
+ result.push(..._invoke(q, getdeepname));
1020
+ result[result.length - 1].ret_ = true;
1021
+ q = [];
1022
+ q.name = cloneNode(name);
1023
+ }
1010
1024
  q.push(RE);
1011
1025
  }
1012
1026
  else if (o.text === '&&') {
1013
1027
  q.push(RZ);
1028
+ xorcount++;
1014
1029
  }
1015
1030
  else if (o.text === '??') {
1031
+ xorcount++;
1016
1032
  q.push(RD);
1017
1033
  }
1018
1034
  hasor = true;
@@ -1065,12 +1081,9 @@ var _express = function (body, getname, ret) {
1065
1081
  }
1066
1082
  }
1067
1083
  if (needname) q.name = [{ text: getname(nameindex), type: EXPRESS }];
1068
- relink(q);
1069
- if (isFunctionOnly(q, 2)) {
1070
- result = [q];
1071
- }
1072
- else {
1073
- result = _invoke(q, getdeepname);
1084
+ if (q.length) {
1085
+ relink(q);
1086
+ result.push(..._invoke(q, getdeepname));
1074
1087
  }
1075
1088
  if (hasor) result[result.length - 1].ret_ = true;
1076
1089
  return result;
@@ -158,4 +158,5 @@ unstruct.debug = true; r++;
158
158
  r++// test("if(a)else {}",'')
159
159
  test("if(a){if(b){c}d}else{e}", `if (!a) return [2, 0]; if (!b) return [1, 0]; c; return [1, 0];\r\n d; return [2, 0];\r\n e; return [1, 0]`)
160
160
  test("if(a){if(b){c}else{d}}else{e}", `if (!a) return [3, 0]; if (!b) return [1, 0]; c; return [2, 0];\r\n d; return [1, 0];\r\n return [2, 0];\r\n e; return [1, 0]`)
161
+ test("if(a&&b||c){d}", `_ = a; if (!_) return [1, 0]; _ = b;\r\n if (_) return [1, 0]; _ = c;\r\n if (!_) return [1, 0]; d; return [1, 0]`, true);
161
162
  test("if(a)switch(b){case c:d;break;} else{h}", `if (!a) return [3, 0]; if (b === c) return [1, 0]; return [2, 0];\r\n d; return [1, 0];\r\n return [2, 0];\r\n h; return [1, 0]`)