diff --git a/src/nodes/BlockStatement.ts b/src/nodes/BlockStatement.ts index 404ade5..417782d 100644 --- a/src/nodes/BlockStatement.ts +++ b/src/nodes/BlockStatement.ts @@ -9,7 +9,7 @@ export default class BlockStatement extends BaseJSNode { if (stmt.type === 'ReturnStatement') return result; - if (result === 'break' || result === 'continue') + if (result === '$jintr_break_' || result === '$jintr_continue_') return result; if ( diff --git a/src/nodes/BreakStatement.ts b/src/nodes/BreakStatement.ts index d606b7a..6e4128b 100644 --- a/src/nodes/BreakStatement.ts +++ b/src/nodes/BreakStatement.ts @@ -4,6 +4,6 @@ import BaseJSNode from './BaseJSNode.js'; export default class BreakStatement extends BaseJSNode { public run(): any { // @TODO: Parse label - return 'break'; + return '$jintr_break_'; } } \ No newline at end of file diff --git a/src/nodes/ContinueStatement.ts b/src/nodes/ContinueStatement.ts index b9d4f27..deea543 100644 --- a/src/nodes/ContinueStatement.ts +++ b/src/nodes/ContinueStatement.ts @@ -3,6 +3,6 @@ import BaseJSNode from './BaseJSNode.js'; export default class ContinueStatement extends BaseJSNode { public run(): any { - return 'continue'; + return '$jintr_continue_'; } } \ No newline at end of file diff --git a/src/nodes/ForOfStatement.ts b/src/nodes/ForOfStatement.ts index 14a7df6..7dc5fc9 100644 --- a/src/nodes/ForOfStatement.ts +++ b/src/nodes/ForOfStatement.ts @@ -20,11 +20,11 @@ export default class ForOfStatement extends BaseJSNode { const body = this.visitor.visitNode(this.node.body); - if (body === 'break') { + if (body === '$jintr_break_') { break; } - if (body === 'continue') { + if (body === '$jintr_continue_') { continue; } diff --git a/src/nodes/ForStatement.ts b/src/nodes/ForStatement.ts index 9726df9..f1270d0 100644 --- a/src/nodes/ForStatement.ts +++ b/src/nodes/ForStatement.ts @@ -22,11 +22,11 @@ export default class ForStatement extends BaseJSNode { const body = this.visitor.visitNode(this.node.body); - if (body === 'continue') { + if (body === '$jintr_continue_') { continue; } - if (body === 'break') { + if (body === '$jintr_break_') { break; } diff --git a/src/nodes/SwitchStatement.ts b/src/nodes/SwitchStatement.ts index 7d47042..f2d0495 100644 --- a/src/nodes/SwitchStatement.ts +++ b/src/nodes/SwitchStatement.ts @@ -16,12 +16,12 @@ export default class SwitchStatement extends BaseJSNode 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; } diff --git a/src/nodes/WhileStatement.ts b/src/nodes/WhileStatement.ts index 011270c..ba14d9f 100644 --- a/src/nodes/WhileStatement.ts +++ b/src/nodes/WhileStatement.ts @@ -6,10 +6,10 @@ export default class WhileStatement extends BaseJSNode { 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)