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/fesm2015/mevento.mjs
CHANGED
|
@@ -883,7 +883,7 @@ class Parser {
|
|
|
883
883
|
if (((_a = this.currentToken) === null || _a === void 0 ? void 0 : _a.type) != TokenType.rbrace) {
|
|
884
884
|
properties.push(this._property());
|
|
885
885
|
}
|
|
886
|
-
while (((_b = this.currentToken) === null || _b === void 0 ? void 0 : _b.type)
|
|
886
|
+
while (((_b = this.currentToken) === null || _b === void 0 ? void 0 : _b.type) === TokenType.comma) {
|
|
887
887
|
this._eat(TokenType.comma);
|
|
888
888
|
properties.push(this._property());
|
|
889
889
|
}
|
|
@@ -1007,8 +1007,7 @@ class Parser {
|
|
|
1007
1007
|
// endBlock
|
|
1008
1008
|
this._eat(TokenType.rbrace);
|
|
1009
1009
|
}
|
|
1010
|
-
|
|
1011
|
-
return ret;
|
|
1010
|
+
return new BlockStatementAST(body, this.currentToken);
|
|
1012
1011
|
}
|
|
1013
1012
|
_ifStatement() {
|
|
1014
1013
|
this._eat(TokenType.IF);
|
|
@@ -1048,7 +1047,7 @@ class Parser {
|
|
|
1048
1047
|
const token = this.currentToken;
|
|
1049
1048
|
this._eat(TokenType.WHILE_TILL);
|
|
1050
1049
|
const test = this._expression();
|
|
1051
|
-
const body = this.currentToken.type
|
|
1050
|
+
const body = this.currentToken.type === TokenType.lbrace ? this._blockStatement() : this._expression();
|
|
1052
1051
|
return new WhileLoopStatement(test, body, token, this.currentToken);
|
|
1053
1052
|
}
|
|
1054
1053
|
_forOfIdentifier() {
|
|
@@ -1113,13 +1112,13 @@ class Parser {
|
|
|
1113
1112
|
else {
|
|
1114
1113
|
update = new LiteralAST(new Token(TokenType.numberConst, 1, this.currentToken.line, this.currentToken.col), "1");
|
|
1115
1114
|
}
|
|
1116
|
-
const body = (this.currentToken.type
|
|
1115
|
+
const body = (this.currentToken.type === TokenType.lbrace) ? this._blockStatement() : this._expression();
|
|
1117
1116
|
node = new ForLoopStatement(node, test, update, direction, body, startToken, this.currentToken);
|
|
1118
1117
|
}
|
|
1119
1118
|
else if (forOf) {
|
|
1120
1119
|
this._eat(TokenType.in);
|
|
1121
1120
|
const collection = this._expression();
|
|
1122
|
-
const body = (this.currentToken.type
|
|
1121
|
+
const body = (this.currentToken.type === TokenType.lbrace) ? this._blockStatement() : this._expression();
|
|
1123
1122
|
node = new ForOfStatement(node, collection, body, startToken, this.currentToken);
|
|
1124
1123
|
}
|
|
1125
1124
|
else {
|
|
@@ -1210,19 +1209,8 @@ class ANodeVisitor {
|
|
|
1210
1209
|
this._nodesVisitors[methodName] = visitor;
|
|
1211
1210
|
}
|
|
1212
1211
|
}
|
|
1213
|
-
class AsyncNodeVisitor extends ANodeVisitor {
|
|
1214
|
-
visit(node) {
|
|
1215
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1216
|
-
const methodName = `visit${node.constructor.name}`;
|
|
1217
|
-
// const fn = Object.getPrototypeOf(this)[methodName];
|
|
1218
|
-
const fn = this._nodesVisitors[methodName];
|
|
1219
|
-
return yield (fn === null || fn === void 0 ? void 0 : fn.call(this, node));
|
|
1220
|
-
});
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
1212
|
class NodeVisitor extends ANodeVisitor {
|
|
1224
1213
|
visit(node) {
|
|
1225
|
-
// console.log('node::', node);
|
|
1226
1214
|
const methodName = `visit${node.constructor.name}`;
|
|
1227
1215
|
// const fn = Object.getPrototypeOf(this)[methodName];
|
|
1228
1216
|
const fn = this._nodesVisitors[methodName];
|
|
@@ -1946,5 +1934,5 @@ class MEventoAsync extends MEvento {
|
|
|
1946
1934
|
* Generated bundle index. Do not edit.
|
|
1947
1935
|
*/
|
|
1948
1936
|
|
|
1949
|
-
export { MEvento, MEventoAsync };
|
|
1937
|
+
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 };
|
|
1950
1938
|
//# sourceMappingURL=mevento.mjs.map
|