mevento 1.2.0 → 1.2.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/esm2020/lib/mevento.mjs +32 -42
- package/fesm2015/mevento.mjs +6 -18
- package/fesm2015/mevento.mjs.map +1 -1
- package/fesm2020/mevento.mjs +6 -16
- package/fesm2020/mevento.mjs.map +1 -1
- package/lib/mevento.d.ts +95 -21
- package/package.json +1 -1
package/fesm2020/mevento.mjs
CHANGED
|
@@ -875,7 +875,7 @@ class Parser {
|
|
|
875
875
|
if (this.currentToken?.type != TokenType.rbrace) {
|
|
876
876
|
properties.push(this._property());
|
|
877
877
|
}
|
|
878
|
-
while (this.currentToken?.type
|
|
878
|
+
while (this.currentToken?.type === TokenType.comma) {
|
|
879
879
|
this._eat(TokenType.comma);
|
|
880
880
|
properties.push(this._property());
|
|
881
881
|
}
|
|
@@ -997,8 +997,7 @@ class Parser {
|
|
|
997
997
|
// endBlock
|
|
998
998
|
this._eat(TokenType.rbrace);
|
|
999
999
|
}
|
|
1000
|
-
|
|
1001
|
-
return ret;
|
|
1000
|
+
return new BlockStatementAST(body, this.currentToken);
|
|
1002
1001
|
}
|
|
1003
1002
|
_ifStatement() {
|
|
1004
1003
|
this._eat(TokenType.IF);
|
|
@@ -1038,7 +1037,7 @@ class Parser {
|
|
|
1038
1037
|
const token = this.currentToken;
|
|
1039
1038
|
this._eat(TokenType.WHILE_TILL);
|
|
1040
1039
|
const test = this._expression();
|
|
1041
|
-
const body = this.currentToken.type
|
|
1040
|
+
const body = this.currentToken.type === TokenType.lbrace ? this._blockStatement() : this._expression();
|
|
1042
1041
|
return new WhileLoopStatement(test, body, token, this.currentToken);
|
|
1043
1042
|
}
|
|
1044
1043
|
_forOfIdentifier() {
|
|
@@ -1103,13 +1102,13 @@ class Parser {
|
|
|
1103
1102
|
else {
|
|
1104
1103
|
update = new LiteralAST(new Token(TokenType.numberConst, 1, this.currentToken.line, this.currentToken.col), "1");
|
|
1105
1104
|
}
|
|
1106
|
-
const body = (this.currentToken.type
|
|
1105
|
+
const body = (this.currentToken.type === TokenType.lbrace) ? this._blockStatement() : this._expression();
|
|
1107
1106
|
node = new ForLoopStatement(node, test, update, direction, body, startToken, this.currentToken);
|
|
1108
1107
|
}
|
|
1109
1108
|
else if (forOf) {
|
|
1110
1109
|
this._eat(TokenType.in);
|
|
1111
1110
|
const collection = this._expression();
|
|
1112
|
-
const body = (this.currentToken.type
|
|
1111
|
+
const body = (this.currentToken.type === TokenType.lbrace) ? this._blockStatement() : this._expression();
|
|
1113
1112
|
node = new ForOfStatement(node, collection, body, startToken, this.currentToken);
|
|
1114
1113
|
}
|
|
1115
1114
|
else {
|
|
@@ -1198,17 +1197,8 @@ class ANodeVisitor {
|
|
|
1198
1197
|
this._nodesVisitors[methodName] = visitor;
|
|
1199
1198
|
}
|
|
1200
1199
|
}
|
|
1201
|
-
class AsyncNodeVisitor extends ANodeVisitor {
|
|
1202
|
-
async visit(node) {
|
|
1203
|
-
const methodName = `visit${node.constructor.name}`;
|
|
1204
|
-
// const fn = Object.getPrototypeOf(this)[methodName];
|
|
1205
|
-
const fn = this._nodesVisitors[methodName];
|
|
1206
|
-
return await fn?.call(this, node);
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
1200
|
class NodeVisitor extends ANodeVisitor {
|
|
1210
1201
|
visit(node) {
|
|
1211
|
-
// console.log('node::', node);
|
|
1212
1202
|
const methodName = `visit${node.constructor.name}`;
|
|
1213
1203
|
// const fn = Object.getPrototypeOf(this)[methodName];
|
|
1214
1204
|
const fn = this._nodesVisitors[methodName];
|
|
@@ -1890,5 +1880,5 @@ class MEventoAsync extends MEvento {
|
|
|
1890
1880
|
* Generated bundle index. Do not edit.
|
|
1891
1881
|
*/
|
|
1892
1882
|
|
|
1893
|
-
export { MEvento, MEventoAsync };
|
|
1883
|
+
export { AST, ArrayExpression, AssignmentExpressionAST, BinaryExpressionAST, BlockStatementAST, BreakAST, BreakBranch, CallExpressionAST, ExpressionStatementAST, ForLoopStatement, ForOfStatement, IdentifierAST, IfStatementAST, IndexAccessorAST, LexerDictionary, LiteralAST, LogicalExpressionAST, MEvento, MEventoAsync, NodeVisitor, ObjectExpression, ObjectProperty, RootAST, Token, TokenType, TupleExpression, UnaryExpressionAST, WhileLoopStatement };
|
|
1894
1884
|
//# sourceMappingURL=mevento.mjs.map
|