Added functions and ensured the context was being passed around correctly

This commit is contained in:
Stefan Zermatten
2020-09-18 11:52:44 +02:00
parent 06f17a6d33
commit 6570665c1e
12 changed files with 209 additions and 53 deletions

View File

@@ -9,9 +9,9 @@ export default class OperatorNode extends ParseNode {
this.fn = fn;
this.operator = operator;
}
resolve(fn, scope){
let leftNode = this.left[fn](scope);
let rightNode = this.right[fn](scope);
resolve(fn, scope, context){
let leftNode = this.left[fn](scope, context);
let rightNode = this.right[fn](scope, context);
let left, right;
if (leftNode.type !== 'number' || rightNode.type !== 'number'){
return new OperatorNode({