efront 4.19.4 → 4.19.5
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
|
@@ -986,10 +986,21 @@ var _express = function (body, getname, ret) {
|
|
|
986
986
|
var p = 0;
|
|
987
987
|
if (o.unary) p = powermap["!"];
|
|
988
988
|
else p = powermap[o.text];
|
|
989
|
-
var b = body.slice(bx, cx + 1);
|
|
990
|
-
bx = cx + 1;
|
|
991
|
-
b.index = nameindex;
|
|
992
989
|
var isor = p === powermap["||"];
|
|
990
|
+
var b = body.slice(bx, cx);
|
|
991
|
+
if (isor || isempty(b, SPACE | COMMENT) || canbeTemp(b) || p <= powermap["="] || !o.unary && /^(\+\+|\-\-)$/.test(o.text)) {
|
|
992
|
+
b = body.slice(bx, cx + 1);
|
|
993
|
+
b.index = nameindex;
|
|
994
|
+
}
|
|
995
|
+
else {
|
|
996
|
+
if (needcomma(q)) q.push({ type: STAMP, text: ';' });
|
|
997
|
+
q.push(...scanner2(`${getname(nameindex)}=`), ...b);
|
|
998
|
+
b = [{ text: getname(nameindex), type: EXPRESS }, body[cx]];
|
|
999
|
+
b.index = nameindex;
|
|
1000
|
+
nameindex++;
|
|
1001
|
+
if (maxindex < nameindex) maxindex = nameindex;
|
|
1002
|
+
}
|
|
1003
|
+
bx = cx + 1;
|
|
993
1004
|
if (!isor) if (!cache.length || p > cache[cache.length - 1] || p >= powermap.new) {
|
|
994
1005
|
cache.push(b, p);
|
|
995
1006
|
continue;
|
|
@@ -102,13 +102,13 @@ test("if(a) a = 1;function* a(){}", "a = function *() {}; if (!a) return [1, 0];
|
|
|
102
102
|
test("await new Promise(function(){})", '_ = function () {}; _ = new Promise(_); return [_, 1]', true);
|
|
103
103
|
test(`onerror({ status: xhr.status, response: "Cookie解析异常!", toString: toResponse })`, '_ = { status: xhr.status, response: "Cookie解析异常!", toString: toResponse }; onerror(_)', true);
|
|
104
104
|
test(`if (!/^https\\:\\/\\/|^s\\/\\//.test(url)) console.warn("请使用https访问如下路径:" + url)`, '_ = /^https\\:\\/\\/|^s\\/\\//.test(url); if (_) return [1, 0]; _ = "请使用https访问如下路径:" + url; _ = console.warn(_); return [1, 0]', true);
|
|
105
|
-
test(`url += (/\\?/.test(url) ? "&" : "?") + datas;`, '
|
|
105
|
+
test(`url += (/\\?/.test(url) ? "&" : "?") + datas;`, '_0 = /\\?/.test(url); if (!_0) return [1, 0]; _0 = "&"; return [2, 0];\r\n _0 = "?"; return [1, 0];\r\n _ = _0, _ = _ + datas; url = url + _', true);
|
|
106
106
|
test(`a = newname.querySelector("input,textarea").value = c.name.replace(/\\/$/, '')`, `_ = newname.querySelector("input,textarea"); _0 = c.name.replace(/\\/$/, ''); _.value = _0; a = _0`, true);
|
|
107
107
|
test(`if (selected[f.url]) f.selected = true;`, `_ = f.url; _ = selected[_]; if (!_) return [1, 0]; f.selected = true; return [1, 0]`, true);
|
|
108
|
-
test(`location.protocol
|
|
109
|
-
test(`var base = location.protocol + "//" + parseURL(this.$scope.data.host).host + "/";`, `_ = location.protocol + "//"
|
|
108
|
+
test(`location.protocol + parseURL(a.b).host `, `_ = location.protocol, _0 = a.b; _0 = parseURL(_0); _ + _0.host`, true);
|
|
109
|
+
test(`var base = location.protocol + "//" + parseURL(this.$scope.data.host).host + "/";`, `_ = location.protocol, _ = _ + "//"; _1 = this.$scope.data.host; _1 = parseURL(_1); _0 = _1.host, _ = _ + _0, base = _ + "/"`, true);
|
|
110
110
|
test(`a=a+b*c+c*d`, `_ = b * c, _ = a + _, _0 = c * d, a = _ + _0`, true);
|
|
111
|
-
test(`cc.name += "<f test></f>"`, `_ = cc.name + "<f test></f>"; cc.name = _`, true);
|
|
111
|
+
test(`cc.name += "<f test></f>"`, `_ = cc.name, _ = _ + "<f test></f>"; cc.name = _`, true);
|
|
112
112
|
test("throw a", 'throw a', true);
|
|
113
113
|
test("throw a,b", 'a; throw b', true);
|
|
114
114
|
test("return a,b", 'a; return [b, 2]', true);
|
|
@@ -119,8 +119,8 @@ test("a(b,b+=1)", '_ = b; _0 = b + 1; b = _0; a(_, _0)', true);
|
|
|
119
119
|
test("while(a){if(b){if(c);else d;continue;}}", 'if (!a) return [4, 0]; if (!b) return [3, 0]; if (!c) return [1, 0]; return [2, 0];\r\n d; return [1, 0];\r\n return [-2, 0];\r\n return [-3, 0]', true);
|
|
120
120
|
test("/*abc*/", '/*abc*/', true);
|
|
121
121
|
test("//aaa", '//aaa', true);
|
|
122
|
-
test("menus[0].name+='aaa'", "_ = menus[0]; _0 = _.name + 'aaa'; _.name = _0", true);
|
|
123
|
-
test("menus[a+b].name+='aaa'", "_ = a + b; _ = menus[_]; _0 = _.name + 'aaa'; _.name = _0", true);
|
|
122
|
+
test("menus[0].name+='aaa'", "_ = menus[0]; _0 = _.name, _0 = _0 + 'aaa'; _.name = _0", true);
|
|
123
|
+
test("menus[a+b].name+='aaa'", "_ = a + b; _ = menus[_]; _0 = _.name, _0 = _0 + 'aaa'; _.name = _0", true);
|
|
124
124
|
test("menus[a+b]()", "_ = a + b; menus[_]()", true);
|
|
125
125
|
test(`switch(a){default: a;case 1:b;}`, 'if (a === 1) return [2, 0]; return [1, 0];\r\n a; return [1, 0];\r\n b; return [1, 0]', true);
|
|
126
126
|
test("loop:{a=b;if(a) continue loop}", "a = b; if (a) return [0, 0]", true);
|
|
@@ -130,9 +130,9 @@ test("predef[key[1]](r.slice(key[0].length).trim())", '_ = key[1]; _0 = key[0].l
|
|
|
130
130
|
test("predef[key[1]](r.slice())(r.slice())", '_ = key[1]; _0 = r.slice(); _ = predef[_](_0); _0 = r.slice(); _(_0)');
|
|
131
131
|
test("predef[key[1]][key[2]][key[3]]", '_ = key[1]; _ = predef[_]; _0 = key[2]; _ = _[_0]; _0 = key[3]; _[_0]');
|
|
132
132
|
test("[key[1]][key[2]][key[3]]", '_ = key[1]; _ = [_]; _0 = key[2]; _ = _[_0]; _0 = key[3]; _[_0]');
|
|
133
|
-
test("[key[1]][key[2]]+[key[3]][key[4]]", '
|
|
133
|
+
test("[key[1]][key[2]]+[key[3]][key[4]]", '_0 = key[1]; _0 = [_0]; _1 = key[2]; _ = _0[_1], _1 = key[3]; _0 = [_1]; _1 = key[4]; _ + _0[_1]');
|
|
134
134
|
test("if(a)a:{break a}", "if (!a) return [2, 0]; return [1, 0];\r\n return [1, 0]", true);
|
|
135
|
-
test("rgb=(rgb<<8|rgb>>16)&0xffffff", "
|
|
135
|
+
test("rgb=(rgb<<8|rgb>>16)&0xffffff", "_0 = rgb << 8, _1 = rgb >> 16, _0 = _0 | _1; _ = _0, rgb = _ & 0xffffff", true);
|
|
136
136
|
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]")
|
|
137
137
|
test(`switch(a){case a:a=a?1:0;break;case b:a=b;break;}`, "if (a === a) return [1, 0]; if (a === b) return [4, 0]; return [5, 0];\r\n if (!a) return [1, 0]; a = 1; return [2, 0];\r\n a = 0; return [1, 0];\r\n return [2, 0];\r\n a = b; return [1, 0]");
|
|
138
138
|
test(`a=typeof a!==1`, "_ = typeof a, a = _ !== 1");
|
|
@@ -153,8 +153,7 @@ 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
|
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');
|
|
155
155
|
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);
|
|
156
|
-
test("p ? (ishttps ? `https` : `http`).toUpperCase() + i18n`端口` + (ishttps ? ': ' : ': ') + p : ''", "if (!p) return [1, 0]; if (!ishttps) return [1, 0];
|
|
157
|
-
unstruct.debug = true; r++;
|
|
156
|
+
test("p ? (ishttps ? `https` : `http`).toUpperCase() + i18n`端口` + (ishttps ? ': ' : ': ') + p : ''", "if (!p) return [1, 0]; if (!ishttps) return [1, 0]; _1 = `https`; return [2, 0];\r\n _1 = `http`; return [1, 0];\r\n _ = _1.toUpperCase(); _0 = i18n`端口`, _ = _ + _0; if (!ishttps) return [1, 0]; _2 = ': '; return [2, 0];\r\n _2 = ': '; return [1, 0];\r\n _0 = _2, _ = _ + _0, _ = _ + p; return [2, 0];\r\n ''; return [1, 0]")
|
|
158
157
|
r++// test("if(a)else {}",'')
|
|
159
158
|
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
159
|
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]`)
|
|
@@ -164,3 +163,6 @@ test("var res = null, krc;", `res = null; krc`)
|
|
|
164
163
|
test("res = null, krc;", `res = null; krc`)
|
|
165
164
|
test(`while (a && b);`, '_ = a; if (!_) return [1, 0]; _ = b;\r\n if (!_) return [1, 0]; return [-1, 0]', true);
|
|
166
165
|
test(`while (a < b);`, '_ = a < b; if (!_) return [1, 0]; return [0, 0]', true);
|
|
166
|
+
unstruct.debug = true; r++;
|
|
167
|
+
test(`if (a() > a+b);`, '_ = a(), _0 = a + b, _ = _ > _0; if (!_) return [1, 0]; return [1, 0]', true);
|
|
168
|
+
test(`index > start && result.length < pageSize`, '_ = index > start; if (!_) return [1, 0]; _ = result.length, _ < pageSize', true);
|
|
@@ -64,7 +64,7 @@ return a => {
|
|
|
64
64
|
var { name, singer } = parseFileName(b);
|
|
65
65
|
data.name = name;
|
|
66
66
|
data.singer = singer;
|
|
67
|
-
data.url = "song/" + b;
|
|
67
|
+
data.url = "https://efront.cc/song/" + b;
|
|
68
68
|
}
|
|
69
69
|
if (!data.singer) {
|
|
70
70
|
data.singer = data.author_name;
|
|
@@ -79,7 +79,7 @@ return a => {
|
|
|
79
79
|
if (data.singer) data.singer = formatSingerNames(data.singer);
|
|
80
80
|
if (!data.avatar && data.singer) {
|
|
81
81
|
var singer0 = data.singer.split("、")[0];
|
|
82
|
-
if (singer0 in singerPhotosMap) data.avatar = `singer/` + singerPhotosMap[singer0];
|
|
82
|
+
if (singer0 in singerPhotosMap) data.avatar = `https://efront.cc/singer/` + singerPhotosMap[singer0];
|
|
83
83
|
}
|
|
84
84
|
if (!data.singerName) data.singerName = data.singer;
|
|
85
85
|
if (!data.songName) data.songName = data.name;
|