Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/meriyah.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -5392,7 +5392,7 @@
consume(parser, context | 32768, 67174411);
const test = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos);
consume(parser, context | 32768, 16);
consumeOpt(parser, context, 1074790417);
consumeOpt(parser, context | 32768, 1074790417);
return finishNode(parser, context, start, line, column, {
type: 'DoWhileStatement',
body,
Expand Down
4 changes: 2 additions & 2 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ export function parseBlock(

consume(parser, context | Context.AllowRegExp, Token.RightBrace);

const blockNode = <ESTree.BlockStatement> finishNode(parser, context, start, line, column, {
const blockNode = <ESTree.BlockStatement>finishNode(parser, context, start, line, column, {
type: 'BlockStatement',
body
});
Expand Down Expand Up @@ -1882,7 +1882,7 @@ export function parseDoWhileStatement(
// The previous token is ) and the inserted semicolon would then be parsed as the terminating semicolon of a do-while statement (13.7.2).
// This cannot be implemented in matchOrInsertSemicolon() because it doesn't know
// this RightRaren is the end of a do-while statement.
consumeOpt(parser, context, Token.Semicolon);
consumeOpt(parser, context | Context.AllowRegExp, Token.Semicolon);
return finishNode(parser, context, start, line, column, {
type: 'DoWhileStatement',
body,
Expand Down
49 changes: 49 additions & 0 deletions test/parser/statements/do-while.ts
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,55 @@ while(y)
}
]
}
],
[
'do { } while (a); /^.*$/.test(b)',
Context.OptionsWebCompat,
{
type: 'Program',
sourceType: 'script',
body: [
{
type: 'DoWhileStatement',
body: {
type: 'BlockStatement',
body: []
},
test: {
type: 'Identifier',
name: 'a'
}
},
{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
object: {
type: 'Literal',
value: /^.*$/,
regex: {
pattern: '^.*$',
flags: ''
}
},
computed: false,
property: {
type: 'Identifier',
name: 'test'
}
},
arguments: [
{
type: 'Identifier',
name: 'b'
}
]
}
}
]
}
]
]);
});