efront 4.6.1 → 4.6.3
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/Javascript.js +1 -1
- package/coms/compile/common.js +10 -9
- package/package.json +1 -1
- package/public/efront.js +1 -1
|
@@ -29,6 +29,7 @@ const {
|
|
|
29
29
|
replace,
|
|
30
30
|
skipAssignment,
|
|
31
31
|
insertAfter,
|
|
32
|
+
pickSentence,
|
|
32
33
|
unshort,
|
|
33
34
|
} = require("./common");
|
|
34
35
|
var straps = `if,in,do,as,of
|
|
@@ -345,7 +346,6 @@ Javascript.prototype.setType = function (o) {
|
|
|
345
346
|
if (this.detectLabel(o)) return false;
|
|
346
347
|
var last = o.prev;
|
|
347
348
|
if (o.type === EXPRESS && /^\.[^\.]|^\.$/.test(o.text) && last && last.type === STAMP && last.text === "?") {
|
|
348
|
-
last = o.prev = snapExpressHead(last.prev);
|
|
349
349
|
last.type = EXPRESS;
|
|
350
350
|
return false;
|
|
351
351
|
}
|
package/coms/compile/common.js
CHANGED
|
@@ -16,6 +16,7 @@ const [
|
|
|
16
16
|
// --------------//1//2/////////////////////////22/////////////2//2//3//4/////4////////3/////3//////3//3//////3///////211/////////////2//////2//////1///
|
|
17
17
|
var number_reg = /^(?:(?:0x[0-9a-f]+|0b\d+|0o\d+)(?:_[0-9a-f]+)*|(?:(?:(?:\d+_)*\d+|\d*)\.\d+(?:_\d+)*|(?:\d+_)*\d+\.?))(?:e[\+\-]?\d+(?:_\d+)*|[mniul]|ll)?$/i;
|
|
18
18
|
var equal_reg = /^(?:[\+\-\*\/~\^&\|%]|\*\*|>>>?|<<)?\=$|^(?:\+\+|\-\-)$/;
|
|
19
|
+
var needhead_reg = /^\?\.|^\.[^\.]|^\[/;
|
|
19
20
|
var skipAssignment = function (o, cx) {
|
|
20
21
|
if (!o) return;
|
|
21
22
|
var next = arguments.length === 1 ? function () {
|
|
@@ -100,7 +101,7 @@ var skipAssignment = function (o, cx) {
|
|
|
100
101
|
next();
|
|
101
102
|
break;
|
|
102
103
|
case EXPRESS:
|
|
103
|
-
if (
|
|
104
|
+
if (needhead_reg.test(o.text)) {
|
|
104
105
|
next();
|
|
105
106
|
break;
|
|
106
107
|
}
|
|
@@ -344,7 +345,7 @@ var snapExpressHead = function (o) {
|
|
|
344
345
|
if (h) return h;
|
|
345
346
|
}
|
|
346
347
|
if (o.type === SCOPED && o.entry !== '{'
|
|
347
|
-
|| o.type === EXPRESS &&
|
|
348
|
+
|| o.type === EXPRESS && needhead_reg.test(o.text)
|
|
348
349
|
|| /\.$/.test(p.text) && !p.isdigit
|
|
349
350
|
|| o.type === QUOTED && (o.length || /^\`/.test(o.text))
|
|
350
351
|
) {
|
|
@@ -416,7 +417,7 @@ var snapExpressFoot = function (o) {
|
|
|
416
417
|
if (!n) break;
|
|
417
418
|
if (n.type === SCOPED && (o.entry !== '{' || isExpress)
|
|
418
419
|
|| /\.$/.test(o.text) && !o.isdigit
|
|
419
|
-
|| n.type === EXPRESS &&
|
|
420
|
+
|| n.type === EXPRESS && needhead_reg.test(n.text)
|
|
420
421
|
|| n.type === QUOTED && (n.length || /^\`/.test(n.text))
|
|
421
422
|
) {
|
|
422
423
|
o = n;
|
|
@@ -1063,7 +1064,7 @@ var createString = function (parsed) {
|
|
|
1063
1064
|
|| prev.type === STAMP && !prev.unary
|
|
1064
1065
|
) {
|
|
1065
1066
|
if (intag || prev.type === ELEMENT && o.type === ELEMENT) break a;
|
|
1066
|
-
if (o.type !== EXPRESS ||
|
|
1067
|
+
if (o.type !== EXPRESS || !needhead_reg.test(o.text) && !prev.tag && !o.tag) {
|
|
1067
1068
|
result.push(" ");
|
|
1068
1069
|
lasttype = SPACE
|
|
1069
1070
|
}
|
|
@@ -1192,7 +1193,7 @@ var createString = function (parsed) {
|
|
|
1192
1193
|
break;
|
|
1193
1194
|
default:
|
|
1194
1195
|
if (o && typeof o === "object") {
|
|
1195
|
-
if (intag || o.
|
|
1196
|
+
if (intag || o.type === EXPRESS && (needhead_reg.test(o.text) || o.prev?.type === EXPRESS && /\.$/.test(o.prev.text)));
|
|
1196
1197
|
else if ((STRAP | EXPRESS | PROPERTY | COMMENT | VALUE) & lasttype && (STRAP | EXPRESS | PROPERTY | VALUE | LABEL) & o.type) {
|
|
1197
1198
|
if (autospace) result.push(" ");
|
|
1198
1199
|
}
|
|
@@ -1484,7 +1485,7 @@ var unshort = function (o, text) {
|
|
|
1484
1485
|
o.type = EXPRESS;
|
|
1485
1486
|
delete o.short;
|
|
1486
1487
|
};
|
|
1487
|
-
var
|
|
1488
|
+
var getBodyWith = function (o, k) {
|
|
1488
1489
|
var q = o.queue;
|
|
1489
1490
|
while (q && (!q.scoped || !q.scoped.used[k])) q = q.queue;
|
|
1490
1491
|
return q;
|
|
@@ -1493,13 +1494,13 @@ var getScopeWith = function (o, k) {
|
|
|
1493
1494
|
var patchArrawScope = function (arraw, origin) {
|
|
1494
1495
|
var s1 = createScoped(arraw);
|
|
1495
1496
|
if (s1.used.this) {
|
|
1496
|
-
var s =
|
|
1497
|
+
var s = getBodyWith(origin, 'this').scoped;
|
|
1497
1498
|
s.used.this.push(...s1.used.this);
|
|
1498
1499
|
s.insett = true;
|
|
1499
1500
|
}
|
|
1500
1501
|
if (s1.used.arguments) {
|
|
1501
1502
|
s.inseta = true;
|
|
1502
|
-
var s =
|
|
1503
|
+
var s = getBodyWith(origin, 'arguments').scoped;
|
|
1503
1504
|
s.used.arguments.push(...s1.used.arguments);
|
|
1504
1505
|
};
|
|
1505
1506
|
};
|
|
@@ -1522,7 +1523,7 @@ module.exports = {
|
|
|
1522
1523
|
unshort,
|
|
1523
1524
|
skipAssignment,
|
|
1524
1525
|
getDeclared,
|
|
1525
|
-
|
|
1526
|
+
getBodyWith,
|
|
1526
1527
|
patchArrawScope,
|
|
1527
1528
|
remove,
|
|
1528
1529
|
createString,
|