Start of action system re-write

This commit is contained in:
Stefan Zermatten
2021-10-09 12:36:06 +02:00
parent 0097696cc8
commit 0cdec4a429
41 changed files with 783 additions and 119 deletions

View File

@@ -1,7 +1,7 @@
import error from './error.js';
import constant from './constant.js';
import functions from '/imports/parser/functions.js';
import resolve, { toString, traverse } from '../resolve.js';
import resolve, { toString, traverse, map } from '../resolve.js';
const call = {
create({functionName, args}) {
@@ -104,6 +104,13 @@ const call = {
fn(node);
node.args.forEach(arg => traverse(arg, fn));
},
map(node, fn){
const resultingNode = fn(node);
if (resultingNode === node){
node.args = node.args.map(arg => map(arg, fn));
}
return resultingNode;
},
checkArugments({node, fn, argumentsExpected, resolvedArgs, context}){
// Check that the number of arguments matches the number expected
if (