AsyncEmbeddedScript allow multiple commands in one block

This commit is contained in:
2023-03-08 07:48:39 -07:00
parent 3d8a1c1bc9
commit dc8851aa14

View File

@@ -176,7 +176,20 @@ class AsyncEmbeddedScript {
#if profileKiss #if profileKiss
Kiss.measure('Compiling kiss: $scriptFile', () -> { Kiss.measure('Compiling kiss: $scriptFile', () -> {
#end #end
Reader.readAndProcess(Stream.fromFile(scriptFile), k, (nextExp) -> { function process(nextExp) {
nextExp = Kiss.macroExpand(nextExp, k);
// Allow packing multiple commands into one exp with a (commands <...>) statement
switch (nextExp.def) {
case CallExp({pos: _, def: Symbol("commands")},
commands):
for (exp in commands) {
process(exp);
}
return;
default:
}
var exprString = Reader.toString(nextExp.def); var exprString = Reader.toString(nextExp.def);
var expr = Kiss.readerExpToHaxeExpr(nextExp, k); var expr = Kiss.readerExpToHaxeExpr(nextExp, k);
if (Kiss.isEmpty(expr)) if (Kiss.isEmpty(expr))
@@ -194,7 +207,8 @@ class AsyncEmbeddedScript {
// This return is essential for type unification of concat() and push() above... ugh. // This return is essential for type unification of concat() and push() above... ugh.
return; return;
}); }
Reader.readAndProcess(Stream.fromFile(scriptFile), k, process);
null; null;
#if profileKiss #if profileKiss
}); });