fix non-caching AsyncEmbeddedScript
This commit is contained in:
@@ -321,12 +321,14 @@ class AsyncEmbeddedScript {
|
|||||||
Kiss.measure('Compiling kiss: $scriptFile', () -> {
|
Kiss.measure('Compiling kiss: $scriptFile', () -> {
|
||||||
#end
|
#end
|
||||||
function process(nextExp) {
|
function process(nextExp) {
|
||||||
|
#if kissCache
|
||||||
var cacheKey = Reader.toString(nextExp.def);
|
var cacheKey = Reader.toString(nextExp.def);
|
||||||
if (cache.exists(cacheKey)) {
|
if (cache.exists(cacheKey)) {
|
||||||
hscriptInstructions[Std.string(commandList.length)] = cache[cacheKey];
|
hscriptInstructions[Std.string(commandList.length)] = cache[cacheKey];
|
||||||
commandList.push(macro null);
|
commandList.push(macro null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
nextExp = Kiss.macroExpand(nextExp, k);
|
nextExp = Kiss.macroExpand(nextExp, k);
|
||||||
var stateChanged = k.stateChanged;
|
var stateChanged = k.stateChanged;
|
||||||
@@ -354,10 +356,12 @@ class AsyncEmbeddedScript {
|
|||||||
$expr;
|
$expr;
|
||||||
};
|
};
|
||||||
// If the expression didn't change the KissState when macroExpanding, it can be cached
|
// If the expression didn't change the KissState when macroExpanding, it can be cached
|
||||||
|
#if kissCache
|
||||||
if (!stateChanged) {
|
if (!stateChanged) {
|
||||||
var expr = Kiss.readerExpToHaxeExpr(nextExp, k.forHScript());
|
var expr = Kiss.readerExpToHaxeExpr(nextExp, k.forHScript());
|
||||||
cache[cacheKey] = expr.toString();
|
cache[cacheKey] = expr.toString();
|
||||||
}
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
commandList.push(c.expr.withMacroPosOf(nextExp));
|
commandList.push(c.expr.withMacroPosOf(nextExp));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user