Completed first pass at action system re-write. Untested

This commit is contained in:
Stefan Zermatten
2021-10-10 19:44:02 +02:00
parent 0cdec4a429
commit 51d3fbbcb7
21 changed files with 232 additions and 840 deletions

View File

@@ -1,10 +1,10 @@
import resolve, { toString } from '/imports/parser/resolve.js';
export default function evaluateCalculation(calculation, scope){
export default function evaluateCalculation(calculation, scope, givenContext){
const parseNode = calculation.parseNode;
const fn = calculation._parseLevel;
const calculationScope = {...calculation._localScope, ...scope};
const {result: resultNode, context} = resolve(fn, parseNode, calculationScope);
const {result: resultNode, context} = resolve(fn, parseNode, calculationScope, givenContext);
calculation.errors = context.errors;
if (resultNode?.parseType === 'constant'){
calculation.value = resultNode.value;