mevento 1.9.8 → 2.0.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.
- package/esm2020/lib/mevento.mjs +11 -11
- package/fesm2015/mevento.mjs +14 -10
- package/fesm2015/mevento.mjs.map +1 -1
- package/fesm2020/mevento.mjs +10 -10
- package/fesm2020/mevento.mjs.map +1 -1
- package/package.json +6 -1
package/fesm2020/mevento.mjs
CHANGED
|
@@ -1092,7 +1092,7 @@ class Parser {
|
|
|
1092
1092
|
else {
|
|
1093
1093
|
consequent = this._expression();
|
|
1094
1094
|
}
|
|
1095
|
-
this._eatSemiOrEOL();
|
|
1095
|
+
// this._eatSemiOrEOL();
|
|
1096
1096
|
let alternate;
|
|
1097
1097
|
if (this.currentToken.type === TokenType.ELSE) {
|
|
1098
1098
|
this._eat(TokenType.ELSE);
|
|
@@ -1401,10 +1401,10 @@ class MEvento extends NodeVisitor {
|
|
|
1401
1401
|
for (const n of list) {
|
|
1402
1402
|
last = this.visit(n);
|
|
1403
1403
|
if (last instanceof ReturnBranch) {
|
|
1404
|
-
return last.value;
|
|
1404
|
+
return last.value ?? null;
|
|
1405
1405
|
}
|
|
1406
1406
|
}
|
|
1407
|
-
return last;
|
|
1407
|
+
return last ?? null;
|
|
1408
1408
|
}
|
|
1409
1409
|
visitBlockStatementAST(node) {
|
|
1410
1410
|
const list = node.body;
|
|
@@ -1420,7 +1420,7 @@ class MEvento extends NodeVisitor {
|
|
|
1420
1420
|
}
|
|
1421
1421
|
}
|
|
1422
1422
|
this.popScope();
|
|
1423
|
-
return last;
|
|
1423
|
+
return last ?? null;
|
|
1424
1424
|
}
|
|
1425
1425
|
visitIdentifierAST(node) {
|
|
1426
1426
|
const id = node.value;
|
|
@@ -1590,11 +1590,11 @@ class MEvento extends NodeVisitor {
|
|
|
1590
1590
|
}
|
|
1591
1591
|
if (typeof owner === 'object') {
|
|
1592
1592
|
const key = this.visit(node.key);
|
|
1593
|
-
return owner[key];
|
|
1593
|
+
return owner[key] ?? null;
|
|
1594
1594
|
}
|
|
1595
1595
|
else if (Array.isArray(owner)) {
|
|
1596
1596
|
const key = this.visit(node.key);
|
|
1597
|
-
return isNum(key) && owner.length < key && key >= 0 ? owner[key] : null;
|
|
1597
|
+
return isNum(key) && owner.length < key && key >= 0 ? owner[key] ?? null : null;
|
|
1598
1598
|
}
|
|
1599
1599
|
return null;
|
|
1600
1600
|
}
|
|
@@ -1806,10 +1806,10 @@ class MEventoAsync extends MEvento {
|
|
|
1806
1806
|
for (const n of list) {
|
|
1807
1807
|
last = await this.visit(n);
|
|
1808
1808
|
if (last instanceof ReturnBranch) {
|
|
1809
|
-
return last.value;
|
|
1809
|
+
return last.value ?? null;
|
|
1810
1810
|
}
|
|
1811
1811
|
}
|
|
1812
|
-
return last;
|
|
1812
|
+
return last ?? null;
|
|
1813
1813
|
}
|
|
1814
1814
|
async visitBlockStatementAST(node) {
|
|
1815
1815
|
const list = node.body;
|
|
@@ -1995,11 +1995,11 @@ class MEventoAsync extends MEvento {
|
|
|
1995
1995
|
}
|
|
1996
1996
|
if (typeof owner === 'object') {
|
|
1997
1997
|
const key = await this.visit(node.key);
|
|
1998
|
-
return owner[key];
|
|
1998
|
+
return owner[key] ?? null;
|
|
1999
1999
|
}
|
|
2000
2000
|
else if (Array.isArray(owner)) {
|
|
2001
2001
|
const key = await this.visit(node.key);
|
|
2002
|
-
return isNum(key) && owner.length < key && key >= 0 ? owner[key] : null;
|
|
2002
|
+
return isNum(key) && owner.length < key && key >= 0 ? owner[key] ?? null : null;
|
|
2003
2003
|
}
|
|
2004
2004
|
return null;
|
|
2005
2005
|
}
|