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 src/nodes/BlockStatement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class BlockStatement extends BaseJSNode<ESTree.BlockStatement> {
if (stmt.type === 'ReturnStatement')
return result;

if (result === 'break' || result === 'continue')
if (result === '$jintr_break_' || result === '$jintr_continue_')
return result;

if (
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/BreakStatement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import BaseJSNode from './BaseJSNode.js';
export default class BreakStatement extends BaseJSNode<ESTree.BreakStatement> {
public run(): any {
// @TODO: Parse label
return 'break';
return '$jintr_break_';
}
}
2 changes: 1 addition & 1 deletion src/nodes/ContinueStatement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import BaseJSNode from './BaseJSNode.js';

export default class ContinueStatement extends BaseJSNode<ESTree.ContinueStatement> {
public run(): any {
return 'continue';
return '$jintr_continue_';
}
}
4 changes: 2 additions & 2 deletions src/nodes/ForOfStatement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export default class ForOfStatement extends BaseJSNode<ESTree.ForOfStatement> {

const body = this.visitor.visitNode(this.node.body);

if (body === 'break') {
if (body === '$jintr_break_') {
break;
}

if (body === 'continue') {
if (body === '$jintr_continue_') {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions src/nodes/ForStatement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export default class ForStatement extends BaseJSNode<ESTree.ForStatement> {

const body = this.visitor.visitNode(this.node.body);

if (body === 'continue') {
if (body === '$jintr_continue_') {
continue;
}

if (body === 'break') {
if (body === '$jintr_break_') {
break;
}

Expand Down
4 changes: 2 additions & 2 deletions src/nodes/SwitchStatement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export default class SwitchStatement extends BaseJSNode<ESTree.SwitchStatement>
const result = this.visitor.visitNode(_case);

// If it's a break then stop here.
if (result === 'break') {
if (result === '$jintr_break_') {
break;
}

// Switch statements do not support continue, but it can be used when inside a while/for loop.
if (result === 'continue') {
if (result === '$jintr_continue_') {
return result;
}

Expand Down
4 changes: 2 additions & 2 deletions src/nodes/WhileStatement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export default class WhileStatement extends BaseJSNode<ESTree.WhileStatement> {
while (this.visitor.visitNode(this.node.test)) {
const body = this.visitor.visitNode(this.node.body);

if (body === 'break')
if (body === '$jintr_break_')
break;

if (body === 'continue')
if (body === '$jintr_continue_')
continue;

if (body)
Expand Down