efront 3.37.0 → 3.38.2
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/#loader.js +3 -2
- package/coms/basic/assert.js +21 -9
- package/coms/basic_/Array2.js +2 -1
- package/coms/basic_/JSON.js +8 -8
- package/coms/basic_/JSON_test.js +80 -2
- package/coms/basic_/Symbol.js +4 -1
- package/coms/basic_/exec_.js +21 -10
- package/coms/basic_/extends_.js +1 -0
- package/coms/compile/Javascript.js +36 -12
- package/coms/compile/Program.js +11 -4
- package/coms/compile/breakcode.js +6 -8
- package/coms/compile/common.js +170 -51
- package/coms/compile/downLevel.js +727 -275
- package/coms/compile/downLevel_test.js +195 -53
- package/coms/compile/powermap.js +2 -2
- package/coms/compile/scanner2.js +23 -2
- package/coms/compile/translate.js +45 -19
- package/coms/compile/unstruct.js +506 -280
- package/coms/compile/unstruct_test.js +66 -40
- package/coms/reptile/colored_console.js +2 -2
- package/coms/zimoli/appendChild.js +1 -1
- package/coms/zimoli/css.js +1 -0
- package/coms/zimoli/deepEqual_test.js +2 -2
- package/coms/zimoli/zimoli.js +1 -0
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/basic/#loader.js
CHANGED
|
@@ -24,6 +24,7 @@ var {
|
|
|
24
24
|
parseFloat,
|
|
25
25
|
encodeURI,
|
|
26
26
|
preventFrame,
|
|
27
|
+
preventCodeStorage = true,
|
|
27
28
|
PREVENT_FRAMEWORK_MODE = preventFrame,
|
|
28
29
|
devicePixelRatio = 1,
|
|
29
30
|
startPath: efrontPath,
|
|
@@ -764,7 +765,7 @@ var initPixelDecoder = function () {
|
|
|
764
765
|
};
|
|
765
766
|
var flush_to_storage_timer = 0,
|
|
766
767
|
responseTree_storageKey = "zimoliAutoSavedResponseTree" + location.pathname;
|
|
767
|
-
var saveResponseTreeToStorage = function () {
|
|
768
|
+
var saveResponseTreeToStorage = preventCodeStorage ? function () { } : function () {
|
|
768
769
|
var responseTextArray = [];
|
|
769
770
|
for (var k in versionTree) {
|
|
770
771
|
if (hasOwnProperty.call(responseTree, k)) responseTextArray.push(
|
|
@@ -774,7 +775,7 @@ var saveResponseTreeToStorage = function () {
|
|
|
774
775
|
var data = responseTextArray.join(",");
|
|
775
776
|
localStorage && localStorage.setItem(responseTree_storageKey, data);
|
|
776
777
|
};
|
|
777
|
-
var loadResponseTreeFromStorage = function () {
|
|
778
|
+
var loadResponseTreeFromStorage = preventCodeStorage ? function () { } : function () {
|
|
778
779
|
"use ./crc.js";
|
|
779
780
|
var load = function (name) {
|
|
780
781
|
var data = localStorage.getItem(responseTree_storageKey);
|
package/coms/basic/assert.js
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
var mark = require("./mark");
|
|
2
2
|
var dump = function (a, msg) {
|
|
3
3
|
if (a instanceof Object) console.error('对象的属性不符合'), console.log(msg ? msg + " " : " ", a);
|
|
4
|
-
else if (msg) console.
|
|
5
|
-
else console.
|
|
4
|
+
else if (msg) console.log(msg + ":", a);
|
|
5
|
+
else console.log(a);
|
|
6
6
|
};
|
|
7
|
+
var colorString = function (s, color) {
|
|
8
|
+
s = String(s);
|
|
9
|
+
var [c0, c1] = color;
|
|
10
|
+
if (s.indexOf(c1) === 0) s = s.slice(c1.length);
|
|
11
|
+
else s = c0 + s;
|
|
12
|
+
if (s.lastIndexOf(c0) === s.length - c0.length) {
|
|
13
|
+
s = s.slice(0, s.length - c0.length);
|
|
14
|
+
}
|
|
15
|
+
else s += c1;
|
|
16
|
+
return s;
|
|
17
|
+
}
|
|
7
18
|
var assert = function (result, expect, log = dump) {
|
|
8
19
|
var errors = {}, hasCollect;
|
|
9
20
|
var collect = function (k, args) {
|
|
@@ -12,14 +23,15 @@ var assert = function (result, expect, log = dump) {
|
|
|
12
23
|
errors = `结果 (${args}) 应为 ${JSON.stringify(k)}`;
|
|
13
24
|
}
|
|
14
25
|
if (k === undefined) return function () {
|
|
15
|
-
var color1 = "bgred";
|
|
16
|
-
var color2 = "bgblue";
|
|
17
|
-
|
|
18
|
-
mark.
|
|
26
|
+
var color1 = console.format("<bgred>; </bgred>").split(";");
|
|
27
|
+
var color2 = console.format("<bgblue>; </bgblue>").split(";");
|
|
28
|
+
var color3 = console.format("<cyan>;</cyan>").split(";");
|
|
29
|
+
mark.setTag1(color1[1], color1[0]);
|
|
30
|
+
mark.setTag2(color2[1], color2[0]);
|
|
19
31
|
var [r, e] = mark.pair(result, expect);
|
|
20
|
-
r =
|
|
21
|
-
e =
|
|
22
|
-
errors =
|
|
32
|
+
r = colorString(r, color1);
|
|
33
|
+
e = colorString(e, color2);
|
|
34
|
+
errors = `${color3[0]}结果 ${color3[1]}${r}\r\n ${color3[0]}应为 ${color3[1]}${e}\r\n`;
|
|
23
35
|
};
|
|
24
36
|
return function (error) {
|
|
25
37
|
if (error instanceof Object) {
|
package/coms/basic_/Array2.js
CHANGED
|
@@ -8,7 +8,8 @@ a: if (!setPrototypeOf) {
|
|
|
8
8
|
if (!getOwnPropertyNames) throw '不支持';
|
|
9
9
|
defineProperty({}, 'o', { value: 0 });
|
|
10
10
|
setPrototypeOf = function (obj, proto) {
|
|
11
|
-
|
|
11
|
+
var names = getOwnPropertyNames(proto)
|
|
12
|
+
for (var n of names) {
|
|
12
13
|
var d = getOwnPropertyDescriptor(proto, n);
|
|
13
14
|
defineProperty(obj, n, d);
|
|
14
15
|
}
|
package/coms/basic_/JSON.js
CHANGED
|
@@ -193,17 +193,17 @@ var getString = function (object, filter, space) {
|
|
|
193
193
|
}
|
|
194
194
|
var str = "";
|
|
195
195
|
if (cx === 0) {
|
|
196
|
-
str +=
|
|
196
|
+
str += ks ? "{" : "[";
|
|
197
197
|
}
|
|
198
198
|
var dx = (ks ? ks : object).length;
|
|
199
199
|
while (cx < dx) {
|
|
200
200
|
key = ks ? ks[cx] : cx;
|
|
201
201
|
var backlength = str.length;
|
|
202
|
-
if (cx > 0) str +=
|
|
203
|
-
if (space) str +=
|
|
202
|
+
if (cx > 0) str += ',';
|
|
203
|
+
if (space) str += '\n' + new Array(objects.length + 1).join(space);
|
|
204
204
|
if (ks) {
|
|
205
|
-
str +=
|
|
206
|
-
if (space) str +=
|
|
205
|
+
str += toString(key) + ":";
|
|
206
|
+
if (space) str += " ";
|
|
207
207
|
};
|
|
208
208
|
var v = get(object[key]);
|
|
209
209
|
if (isObject(v)) {
|
|
@@ -213,7 +213,7 @@ var getString = function (object, filter, space) {
|
|
|
213
213
|
keys.push([0]);
|
|
214
214
|
break;
|
|
215
215
|
} else if (v) {
|
|
216
|
-
str +=
|
|
216
|
+
str += v;
|
|
217
217
|
} else {
|
|
218
218
|
str = str.slice(0, backlength);
|
|
219
219
|
}
|
|
@@ -221,9 +221,9 @@ var getString = function (object, filter, space) {
|
|
|
221
221
|
}
|
|
222
222
|
if (cx === dx) {
|
|
223
223
|
if (dx > 0) {
|
|
224
|
-
if (space) str +=
|
|
224
|
+
if (space) str += '\n' + new Array(objects.length).join(space)
|
|
225
225
|
}
|
|
226
|
-
str +=
|
|
226
|
+
str += ks ? '}' : ']';
|
|
227
227
|
pop();
|
|
228
228
|
}
|
|
229
229
|
result.push(str);
|
package/coms/basic_/JSON_test.js
CHANGED
|
@@ -64,7 +64,7 @@ var test = function (JSON) {
|
|
|
64
64
|
var start = new Date();
|
|
65
65
|
try {
|
|
66
66
|
var res = call(arg, null, space);
|
|
67
|
-
} catch{
|
|
67
|
+
} catch {
|
|
68
68
|
res = "error";
|
|
69
69
|
}
|
|
70
70
|
var delta = new Date - start;
|
|
@@ -79,10 +79,88 @@ var test = function (JSON) {
|
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
};
|
|
82
|
+
var test2 = function (JSON) {
|
|
83
|
+
var data = [{
|
|
84
|
+
"name": i18n(`\u4ee3\u7406\u8def\u5f84`, `Proxy Path`),
|
|
85
|
+
"type": "input",
|
|
86
|
+
"key": "url",
|
|
87
|
+
"comment": "",
|
|
88
|
+
"size": "120",
|
|
89
|
+
"unit": "bit",
|
|
90
|
+
"ratio": 0.125,
|
|
91
|
+
"required": true
|
|
92
|
+
}, {
|
|
93
|
+
"name": i18n(`\u4e8c\u7ef4\u7801`, `QR code`),
|
|
94
|
+
"type": "1byte",
|
|
95
|
+
"key": "url",
|
|
96
|
+
"comment": "",
|
|
97
|
+
"size": "1",
|
|
98
|
+
"unit": "byte",
|
|
99
|
+
"ratio": 1,
|
|
100
|
+
"readonly": true
|
|
101
|
+
}, {
|
|
102
|
+
"name": i18n(`\u771f\u5b9e\u8def\u5f84`, `Real path`),
|
|
103
|
+
"type": "url",
|
|
104
|
+
"key": "realpath",
|
|
105
|
+
"comment": "",
|
|
106
|
+
"size": "300",
|
|
107
|
+
"unit": "bit",
|
|
108
|
+
"ratio": 0.125
|
|
109
|
+
}, {
|
|
110
|
+
"name": i18n(`\u52a8\u4f5c`, `action`),
|
|
111
|
+
"type": "select",
|
|
112
|
+
"key": "action",
|
|
113
|
+
"comment": "",
|
|
114
|
+
"options": [{
|
|
115
|
+
"name": "跳转",
|
|
116
|
+
"value": 0
|
|
117
|
+
}, {
|
|
118
|
+
"name": "转发",
|
|
119
|
+
"value": 1
|
|
120
|
+
}],
|
|
121
|
+
"size": "100",
|
|
122
|
+
"unit": "bit",
|
|
123
|
+
"ratio": 0.125
|
|
124
|
+
}, {
|
|
125
|
+
"name": i18n(`\u72b6\u6001`, `state`),
|
|
126
|
+
"type": "select",
|
|
127
|
+
"key": "status",
|
|
128
|
+
"comment": "",
|
|
129
|
+
"options": [{
|
|
130
|
+
"name": "启用",
|
|
131
|
+
"value": 0
|
|
132
|
+
}, {
|
|
133
|
+
"name": "禁用",
|
|
134
|
+
"value": 1
|
|
135
|
+
}],
|
|
136
|
+
"size": "100",
|
|
137
|
+
"unit": "bit",
|
|
138
|
+
"ratio": 0.125
|
|
139
|
+
}, {
|
|
140
|
+
"name": i18n(``, ``),
|
|
141
|
+
"type": "byte",
|
|
142
|
+
"key": "",
|
|
143
|
+
"comment": "",
|
|
144
|
+
"options": {
|
|
145
|
+
name: "访问",
|
|
146
|
+
do(o) {
|
|
147
|
+
var url = o.url;
|
|
148
|
+
if (!/^\//.test(url))
|
|
149
|
+
url = "/" + url;
|
|
150
|
+
window.open(url, null);
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"size": 1,
|
|
154
|
+
"unit": "byte",
|
|
155
|
+
"ratio": 1,
|
|
156
|
+
"readonly": true
|
|
157
|
+
}];
|
|
158
|
+
assert(JSON.stringify(data, null, 4), JSON0.stringify(data, null, 4))
|
|
159
|
+
}
|
|
82
160
|
function JSON_test() {
|
|
83
161
|
window.JSON0 = JSON0;
|
|
84
162
|
window.JSON = void 0;
|
|
85
163
|
delete modules.JSON;
|
|
86
|
-
modules.init("JSON",
|
|
164
|
+
modules.init("JSON", test2);
|
|
87
165
|
window.JSON = JSON0;
|
|
88
166
|
}
|
package/coms/basic_/Symbol.js
CHANGED
|
@@ -19,7 +19,7 @@ var Symbol = this.Symbol || function () {
|
|
|
19
19
|
Symbol.prototype = prototype;
|
|
20
20
|
Symbol.iterator = Symbol('iterator');
|
|
21
21
|
Symbol.asyncIterator = Symbol('asyncIterator');
|
|
22
|
-
|
|
22
|
+
var iterator = function () {
|
|
23
23
|
var arr = this, cx = 0, dx = arr.length;
|
|
24
24
|
return {
|
|
25
25
|
next() {
|
|
@@ -28,5 +28,8 @@ var Symbol = this.Symbol || function () {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
+
try {
|
|
32
|
+
Object.defineProperty(Array.prototype, Symbol.iterator, { value: iterator, enumerable: false })
|
|
33
|
+
} catch { }
|
|
31
34
|
return Symbol;
|
|
32
35
|
}();
|
package/coms/basic_/exec_.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
var
|
|
1
|
+
var exec_ = function (args, ok, oh, int) {
|
|
2
2
|
var p = null, index = 0, r, finished = false, t = this;
|
|
3
3
|
var next = function (arg) {
|
|
4
4
|
p = arg;
|
|
5
5
|
run();
|
|
6
6
|
};
|
|
7
|
-
var catches = [];
|
|
7
|
+
var catches = [], catch_;
|
|
8
8
|
var thro = function (err) {
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
if (catch_) {
|
|
10
|
+
fina();
|
|
11
|
+
}
|
|
12
|
+
else if (catches.length) {
|
|
13
|
+
catch_ = catches.pop();
|
|
14
|
+
[index, p] = catch_;
|
|
15
|
+
index += p & 0xffff;
|
|
16
|
+
if (p >>> 16) {
|
|
17
|
+
next(err);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
fina();
|
|
21
|
+
}
|
|
14
22
|
}
|
|
15
23
|
else {
|
|
16
24
|
oh(err);
|
|
@@ -24,17 +32,19 @@ var exec = function (args, ok, oh, int) {
|
|
|
24
32
|
};
|
|
25
33
|
var fina = function () {
|
|
26
34
|
// 仅在try或catch未结束时使用
|
|
27
|
-
|
|
35
|
+
if (!catch_) catch_ = catches.pop();
|
|
36
|
+
[index, p] = catch_;
|
|
37
|
+
catch_ = null;
|
|
28
38
|
index += (p >>> 16) + (p & 0xffff);
|
|
29
39
|
next();
|
|
30
40
|
};
|
|
31
41
|
var fine = function () {
|
|
32
|
-
|
|
42
|
+
index++;
|
|
33
43
|
next();
|
|
34
44
|
}
|
|
35
45
|
var run = function () {
|
|
36
46
|
var args_length = args.length, i;
|
|
37
|
-
if (finished && !
|
|
47
|
+
if (finished && !catch_ || index >= args_length) return ok(r);
|
|
38
48
|
while (index < args_length) {
|
|
39
49
|
try {
|
|
40
50
|
[p, i] = args[index].call(t, p) || [1, 0];
|
|
@@ -56,6 +66,7 @@ var exec = function (args, ok, oh, int) {
|
|
|
56
66
|
default: throw "代码异常!";
|
|
57
67
|
}
|
|
58
68
|
}
|
|
69
|
+
catch_ = null;
|
|
59
70
|
retn();
|
|
60
71
|
};
|
|
61
72
|
next();
|
package/coms/basic_/extends_.js
CHANGED
|
@@ -19,21 +19,22 @@ const {
|
|
|
19
19
|
getDeclared,
|
|
20
20
|
createScoped,
|
|
21
21
|
snapExpressHead,
|
|
22
|
+
splice,
|
|
22
23
|
relink,
|
|
23
24
|
replace,
|
|
24
25
|
skipAssignment,
|
|
25
26
|
} = require("./common");
|
|
26
27
|
var straps = `if,in,do,as,of
|
|
27
28
|
var,for,new,try,let,get,set
|
|
28
|
-
else,case,void,with,enum,from
|
|
29
|
-
async,while,break,catch,throw,const,yield,class,await
|
|
29
|
+
else,case,void,with,enum,from
|
|
30
|
+
async,while,break,catch,throw,const,yield,class,await
|
|
30
31
|
return,typeof,delete,switch,export,import,static
|
|
31
32
|
default,finally,extends
|
|
32
33
|
function,continue,debugger
|
|
33
34
|
instanceof`.trim().split(/[,\s]+/);
|
|
34
35
|
class Javascript extends Program {
|
|
35
36
|
straps = straps;
|
|
36
|
-
value_reg = /^(false|true|null|Infinity|NaN|undefined)$/
|
|
37
|
+
value_reg = /^(false|true|null|Infinity|NaN|undefined|eval)$/
|
|
37
38
|
transive_reg = /^(new|var|let|const|yield|void|in|of|typeof|delete|case|return|await|export|default|instanceof|throw|extends|import|from)$/
|
|
38
39
|
strapexp_reg = /^(new|void|typeof|delete|class|function|await)/;
|
|
39
40
|
forceend_reg = /^(return|yield|break|continue|debugger)$/;
|
|
@@ -232,6 +233,23 @@ Javascript.prototype.setType = function (o) {
|
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
235
|
};
|
|
236
|
+
var insertBefore = function (o) {
|
|
237
|
+
var queue = this || o.queue;
|
|
238
|
+
var index = queue.indexOf(o);
|
|
239
|
+
var os = [].slice.call(arguments, 1);
|
|
240
|
+
queue.splice.apply(queue, [index, 0].concat(os));
|
|
241
|
+
var prev = o && o.prev, next = o;
|
|
242
|
+
for (var o of os) {
|
|
243
|
+
if (prev) prev.next = o;
|
|
244
|
+
else queue.first = o;
|
|
245
|
+
o.prev = prev;
|
|
246
|
+
Object.defineProperty(o, 'queue', { value: queue });
|
|
247
|
+
prev = o;
|
|
248
|
+
}
|
|
249
|
+
o.next = next;
|
|
250
|
+
if (next) next.prev = o;
|
|
251
|
+
else queue.last = o;
|
|
252
|
+
}
|
|
235
253
|
var insertAfter = function (o) {
|
|
236
254
|
var queue = this || o.queue;
|
|
237
255
|
var index = queue.indexOf(o) + 1;
|
|
@@ -240,12 +258,14 @@ var insertAfter = function (o) {
|
|
|
240
258
|
var prev = o, next = o && o.next;
|
|
241
259
|
for (var o of os) {
|
|
242
260
|
if (prev) prev.next = o;
|
|
261
|
+
else queue.first = o;
|
|
243
262
|
o.prev = prev;
|
|
244
263
|
Object.defineProperty(o, 'queue', { value: queue });
|
|
245
264
|
prev = o;
|
|
246
265
|
}
|
|
247
266
|
o.next = next;
|
|
248
267
|
if (next) next.prev = o;
|
|
268
|
+
else queue.last = o;
|
|
249
269
|
};
|
|
250
270
|
var js = new Javascript;
|
|
251
271
|
var scan = function (data) {
|
|
@@ -277,8 +297,8 @@ var collectProperty = function (o, text) {
|
|
|
277
297
|
var start = p ? q.indexOf(p) + 1 : 0;
|
|
278
298
|
var n = t.next;
|
|
279
299
|
while (n && (n.type !== STAMP || n.text !== ',')) n = n.next;
|
|
280
|
-
var end = n ? q.indexOf(n) + 1 : q.length;
|
|
281
|
-
var s =
|
|
300
|
+
var end = n ? q.indexOf(n, start) + 1 : q.length;
|
|
301
|
+
var s = splice(q, start, end - start);
|
|
282
302
|
if (s.length) console.info(`属性<green>${text}</green>被后文覆盖,已移除<yellow>${createString(s)}</yellow>\r\n`);
|
|
283
303
|
if (p && n) {
|
|
284
304
|
var pp = p.prev;
|
|
@@ -295,7 +315,7 @@ var hasComma = function (c) {
|
|
|
295
315
|
}
|
|
296
316
|
return false;
|
|
297
317
|
}
|
|
298
|
-
var
|
|
318
|
+
var removeQuote = function (o, c, i) {
|
|
299
319
|
if (hasComma(c)) return;
|
|
300
320
|
if (!isFinite(i)) i = o.indexOf(c);
|
|
301
321
|
o.splice(i, 1, ...c);
|
|
@@ -336,22 +356,26 @@ Javascript.prototype.detour = function detour(o, ie) {
|
|
|
336
356
|
if (!o.prev || o.prev.type & (STAMP | STRAP)) {
|
|
337
357
|
o.type = SCOPED;
|
|
338
358
|
o.entry = '[';
|
|
339
|
-
o.leave = `]["join"](
|
|
359
|
+
o.leave = `]["join"]("")`;
|
|
340
360
|
for (var cx = o.length - 1; cx >= 0; cx--) {
|
|
341
361
|
var c = o[cx];
|
|
342
362
|
if (c.type === PIECE) {
|
|
343
363
|
c.type = QUOTED;
|
|
344
364
|
c.text = strings.recode("`" + c.text + "`");
|
|
365
|
+
splice(o, cx + 1, 0, { type: STAMP, text: ',' });
|
|
345
366
|
}
|
|
346
367
|
else {
|
|
347
|
-
insertAfter.call(o, c.prev, { type: STAMP, text: ',' });
|
|
348
368
|
c.entry = "(";
|
|
349
369
|
c.leave = ")";
|
|
350
370
|
this.detour(c.first, ie);
|
|
351
|
-
|
|
352
|
-
|
|
371
|
+
splice(o, cx + 1, 0, { type: STAMP, text: ',' });
|
|
372
|
+
removeQuote(o, c);
|
|
353
373
|
}
|
|
354
374
|
}
|
|
375
|
+
if (o.length) {
|
|
376
|
+
o.pop();
|
|
377
|
+
o.last = o.last.prev;
|
|
378
|
+
}
|
|
355
379
|
}
|
|
356
380
|
else {
|
|
357
381
|
var raw = [];
|
|
@@ -402,11 +426,11 @@ Javascript.prototype.detour = function detour(o, ie) {
|
|
|
402
426
|
if (ie === undefined || o.prev && (o.prev.type !== STAMP || o.prev.text !== ",") || this.strap_reg.test(o.text)) {
|
|
403
427
|
text = `[${text}]`;
|
|
404
428
|
}
|
|
405
|
-
else {
|
|
429
|
+
else if (ie !== false) {
|
|
406
430
|
collectProperty(o, text);
|
|
407
431
|
}
|
|
408
432
|
if (o.short) {
|
|
409
|
-
|
|
433
|
+
insertBefore.call(o.queue, o, { text: text, short: false, isprop: true, type: PROPERTY }, { text: ':', type: STAMP });
|
|
410
434
|
o.isprop = false;
|
|
411
435
|
o.type = EXPRESS;
|
|
412
436
|
delete o.short;
|
package/coms/compile/Program.js
CHANGED
|
@@ -145,7 +145,7 @@ class Program {
|
|
|
145
145
|
value_reg = /^(false|true|null)$/
|
|
146
146
|
number_reg = number_reg;
|
|
147
147
|
Code = Array;
|
|
148
|
-
transive_reg = /^(new|void|
|
|
148
|
+
transive_reg = /^(new|void|case|break|continue|return|throw|extends|import)$/
|
|
149
149
|
straps = "if,for".split(',');
|
|
150
150
|
colonstrap_reg = /^(case|default)$/;
|
|
151
151
|
forceend_reg = /^(return|break|continue)$/;
|
|
@@ -238,13 +238,16 @@ class Program {
|
|
|
238
238
|
}
|
|
239
239
|
var last = queue.last;
|
|
240
240
|
if (type === SPACE) {
|
|
241
|
-
if (last && last.
|
|
241
|
+
if (last && last.isend === false) {
|
|
242
242
|
last.isend = true;
|
|
243
243
|
queue.inExpress = false;
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
else if (type !== STAMP);
|
|
247
|
-
else if (m === ";")
|
|
247
|
+
else if (m === ";") {
|
|
248
|
+
if (last && last.isend === false) last.isend = true;
|
|
249
|
+
queue.inExpress = false;
|
|
250
|
+
}
|
|
248
251
|
else if (last) check: switch (m) {
|
|
249
252
|
case "?":
|
|
250
253
|
queue.inExpress = true;
|
|
@@ -312,6 +315,10 @@ class Program {
|
|
|
312
315
|
isExpress: queue.inExpress,
|
|
313
316
|
text: m
|
|
314
317
|
}
|
|
318
|
+
if (type === STRAP) {
|
|
319
|
+
if (forceend_reg.test(m)) scope.isend = false;
|
|
320
|
+
if (this.transive_reg.test(m)) scope.transive = true;
|
|
321
|
+
}
|
|
315
322
|
if (isdigit) scope.isdigit = true;
|
|
316
323
|
lasttype = type;
|
|
317
324
|
queue_push(scope);
|
|
@@ -577,7 +584,7 @@ class Program {
|
|
|
577
584
|
else scope.isObject = !/^(;|\+\+|\-\-|=>)$/.test(last.text);
|
|
578
585
|
}
|
|
579
586
|
else if (last.type === STRAP) {
|
|
580
|
-
if (
|
|
587
|
+
if (last.isend);
|
|
581
588
|
else if (this.export_reg.test(last.text));
|
|
582
589
|
else scope.isObject = queue.inExpress;
|
|
583
590
|
}
|
|
@@ -63,19 +63,17 @@ var trimStringLiteral = function (block) {
|
|
|
63
63
|
}
|
|
64
64
|
return block_string;
|
|
65
65
|
};
|
|
66
|
-
var paramsMap =
|
|
66
|
+
var paramsMap = null;
|
|
67
67
|
var module_string = '';
|
|
68
|
-
function breakcode(data,
|
|
69
|
-
if (!
|
|
68
|
+
function breakcode(data, occurs) {
|
|
69
|
+
if (!occurs) return [data];
|
|
70
70
|
module_string = data;
|
|
71
|
-
Object.
|
|
72
|
-
paramsMap[key] = true;
|
|
73
|
-
});
|
|
71
|
+
paramsMap = Object.assign(Object.create(null), occurs);
|
|
74
72
|
var code_blocks = scanner(module_string);
|
|
75
73
|
module_string = code_blocks.map(trimStringLiteral).join("");
|
|
76
|
-
var res = Object.keys(paramsMap).filter(k => !hasOwnProperty.call(
|
|
74
|
+
var res = Object.keys(paramsMap).filter(k => !hasOwnProperty.call(occurs, k));
|
|
77
75
|
var val = res.map(k => paramsMap[k]);
|
|
78
|
-
paramsMap =
|
|
76
|
+
paramsMap = null;
|
|
79
77
|
data = module_string;
|
|
80
78
|
module_string = '';
|
|
81
79
|
return [data, res, val];
|