Comparing version 3.2.0 to 3.2.1
@@ -8,3 +8,3 @@ import BaseJSNode from './BaseJSNode.js'; | ||
return result; | ||
if (result === 'break' || result === 'continue') | ||
if (result === '$jintr_break_' || result === '$jintr_continue_') | ||
return result; | ||
@@ -11,0 +11,0 @@ if ((stmt.type === 'WhileStatement' || |
@@ -5,4 +5,4 @@ import BaseJSNode from './BaseJSNode.js'; | ||
// @TODO: Parse label | ||
return 'break'; | ||
return '$jintr_break_'; | ||
} | ||
} |
import BaseJSNode from './BaseJSNode.js'; | ||
export default class ContinueStatement extends BaseJSNode { | ||
run() { | ||
return 'continue'; | ||
return '$jintr_continue_'; | ||
} | ||
} |
@@ -18,6 +18,6 @@ import BaseJSNode from './BaseJSNode.js'; | ||
const body = this.visitor.visitNode(this.node.body); | ||
if (body === 'break') { | ||
if (body === '$jintr_break_') { | ||
break; | ||
} | ||
if (body === 'continue') { | ||
if (body === '$jintr_continue_') { | ||
continue; | ||
@@ -24,0 +24,0 @@ } |
@@ -18,6 +18,6 @@ import BaseJSNode from './BaseJSNode.js'; | ||
const body = this.visitor.visitNode(this.node.body); | ||
if (body === 'continue') { | ||
if (body === '$jintr_continue_') { | ||
continue; | ||
} | ||
if (body === 'break') { | ||
if (body === '$jintr_break_') { | ||
break; | ||
@@ -24,0 +24,0 @@ } |
@@ -13,7 +13,7 @@ import BaseJSNode from './BaseJSNode.js'; | ||
// 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; | ||
@@ -20,0 +20,0 @@ } |
@@ -6,5 +6,5 @@ import BaseJSNode from './BaseJSNode.js'; | ||
const body = this.visitor.visitNode(this.node.body); | ||
if (body === 'break') | ||
if (body === '$jintr_break_') | ||
break; | ||
if (body === 'continue') | ||
if (body === '$jintr_continue_') | ||
continue; | ||
@@ -11,0 +11,0 @@ if (body) |
{ | ||
"name": "jintr", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "A tiny JavaScript interpreter written in TypeScript.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
57434