allow constructing StringMap in KissInterp
This commit is contained in:
@@ -440,6 +440,8 @@ class Helpers {
|
|||||||
public static function runAtCompileTimeDynamic(exp:ReaderExp, k:KissState, ?args:Map<String, Dynamic>):Dynamic {
|
public static function runAtCompileTimeDynamic(exp:ReaderExp, k:KissState, ?args:Map<String, Dynamic>):Dynamic {
|
||||||
var parsed = compileTimeHScript(exp, k);
|
var parsed = compileTimeHScript(exp, k);
|
||||||
|
|
||||||
|
// The macro interpreter gets everything a KissInterp has,
|
||||||
|
// plus macro-specific things.
|
||||||
var interp = new KissInterp();
|
var interp = new KissInterp();
|
||||||
interp.variables.set("read", Reader.assertRead.bind(_, k));
|
interp.variables.set("read", Reader.assertRead.bind(_, k));
|
||||||
interp.variables.set("readExpArray", Reader.readExpArray.bind(_, _, k));
|
interp.variables.set("readExpArray", Reader.readExpArray.bind(_, _, k));
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import kiss.Prelude;
|
|||||||
|
|
||||||
using hscript.Tools;
|
using hscript.Tools;
|
||||||
|
|
||||||
|
typedef InterpMap = haxe.ds.StringMap<Dynamic>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specialized hscript interpreter for hscript generated from Kiss expressions.
|
* Specialized hscript interpreter for hscript generated from Kiss expressions.
|
||||||
* When macrotest is defined by the compiler, many functions run without
|
* When macrotest is defined by the compiler, many functions run without
|
||||||
@@ -33,6 +35,7 @@ class KissInterp extends Interp {
|
|||||||
variables.set("Throw", ExtraElementHandling.Throw);
|
variables.set("Throw", ExtraElementHandling.Throw);
|
||||||
variables.set("Math", Math);
|
variables.set("Math", Math);
|
||||||
variables.set("Json", haxe.Json);
|
variables.set("Json", haxe.Json);
|
||||||
|
variables.set("StringMap", InterpMap);
|
||||||
variables.set("StringTools", StringTools);
|
variables.set("StringTools", StringTools);
|
||||||
variables.set("Path", haxe.io.Path);
|
variables.set("Path", haxe.io.Path);
|
||||||
#if (sys || hxnodejs)
|
#if (sys || hxnodejs)
|
||||||
|
|||||||
Reference in New Issue
Block a user