cache converted hscript from ktxt2
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
bin/
|
bin/
|
||||||
externLog.txt
|
externLog.txt
|
||||||
|
*.memoized
|
||||||
@@ -48,8 +48,23 @@ class KissInterp extends Interp {
|
|||||||
variables.set("kiss", {});
|
variables.set("kiss", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var cacheConvertedHScript = false;
|
||||||
|
|
||||||
public function evalKiss(kissStr:String):Dynamic {
|
public function evalKiss(kissStr:String):Dynamic {
|
||||||
return evalHaxe(Prelude.convertToHScript(kissStr));
|
#if !(sys || hxnodejs)
|
||||||
|
if (cacheConvertedHScript) {
|
||||||
|
throw "Cannot used cacheConvertedHScript on a non-sys target";
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
var convert =
|
||||||
|
#if (sys || hxnodejs)
|
||||||
|
if (cacheConvertedHScript) {
|
||||||
|
Prelude.cachedConvertToHScript;
|
||||||
|
} else
|
||||||
|
#end
|
||||||
|
Prelude.convertToHScript;
|
||||||
|
return evalHaxe(convert(kissStr));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function evalHaxe(hscriptStr:String):Dynamic {
|
public function evalHaxe(hscriptStr:String):Dynamic {
|
||||||
|
|||||||
@@ -506,6 +506,10 @@ class Prelude {
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (sys || hxnodejs)
|
||||||
|
public static var cachedConvertToHScript:String->String = cast(fsMemoize(convertToHScript, "convertToHScript"));
|
||||||
|
#end
|
||||||
|
|
||||||
public static function getTarget():KissTarget {
|
public static function getTarget():KissTarget {
|
||||||
return #if cpp
|
return #if cpp
|
||||||
Cpp;
|
Cpp;
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
(let [&mut sourceText ""
|
(let [&mut sourceText ""
|
||||||
&mut outputText ""
|
&mut outputText ""
|
||||||
interp (new KissInterp)]
|
interp (new KissInterp)]
|
||||||
|
(set interp.cacheConvertedHScript true)
|
||||||
(doFor ktxtElement (splitFileElements fileStream)
|
(doFor ktxtElement (splitFileElements fileStream)
|
||||||
(case ktxtElement
|
(case ktxtElement
|
||||||
((Block (objectWith source output))
|
((Block (objectWith source output))
|
||||||
|
|||||||
Reference in New Issue
Block a user