pass reflection and expression evaluation to macro evaluator
This commit is contained in:
@@ -334,6 +334,9 @@ class Helpers {
|
||||
for (name => value in k.macroVars) {
|
||||
interp.variables.set(name, value);
|
||||
}
|
||||
// This is kind of a big deal:
|
||||
interp.variables.set("eval", Helpers.runAtCompileTimeDynamic.bind(_, k));
|
||||
|
||||
interps.push(interp);
|
||||
} else {
|
||||
interps.push(new Cloner().clone(interps[-1]));
|
||||
|
@@ -58,6 +58,7 @@ class Kiss {
|
||||
// Helpful built-in aliases
|
||||
// These ones might conflict with a programmer's variable names, so they only apply in call expressions:
|
||||
callAliases: [
|
||||
// TODO some of these probably won't conflict, and could be passed as functions for a number of reasons
|
||||
"print" => Symbol("Prelude.print"),
|
||||
"sort" => Symbol("Prelude.sort"),
|
||||
"groups" => Symbol("Prelude.groups"),
|
||||
@@ -106,7 +107,6 @@ class Kiss {
|
||||
macroVars: new Map()
|
||||
};
|
||||
|
||||
// Helpful aliases
|
||||
return k;
|
||||
}
|
||||
|
||||
|
@@ -19,6 +19,7 @@ class KissInterp extends Interp {
|
||||
|
||||
this.nullForUnknownVar = nullForUnknownVar;
|
||||
|
||||
variables.set("Reflect", Reflect);
|
||||
variables.set("Prelude", Prelude);
|
||||
variables.set("Lambda", Lambda);
|
||||
variables.set("Std", Std);
|
||||
|
Reference in New Issue
Block a user