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