EmbeddedScript and AsyncEmbeddedScript use _try() when building

This commit is contained in:
2021-11-17 17:33:29 -07:00
parent 21bddc14e2
commit 4e856bc4a7
3 changed files with 33 additions and 27 deletions

View File

@@ -61,6 +61,7 @@ class AsyncEmbeddedScript {
scriptFile = Path.join([loadingDirectory, scriptFile]); scriptFile = Path.join([loadingDirectory, scriptFile]);
k.fieldList = []; k.fieldList = [];
Kiss._try(() -> {
Reader.readAndProcess(Stream.fromFile(scriptFile), k, (nextExp) -> { Reader.readAndProcess(Stream.fromFile(scriptFile), k, (nextExp) -> {
var exprString = Reader.toString(nextExp.def); var exprString = Reader.toString(nextExp.def);
var expr = Kiss.readerExpToHaxeExpr(nextExp, k); var expr = Kiss.readerExpToHaxeExpr(nextExp, k);
@@ -78,6 +79,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;
}); });
null;
});
classFields = classFields.concat(k.fieldList); classFields = classFields.concat(k.fieldList);

View File

@@ -62,6 +62,7 @@ class EmbeddedScript {
classFields = classFields.concat(Kiss.build(dslFile, k)); classFields = classFields.concat(Kiss.build(dslFile, k));
scriptFile = Path.join([loadingDirectory, scriptFile]); scriptFile = Path.join([loadingDirectory, scriptFile]);
Kiss._try(() -> {
Reader.readAndProcess(Stream.fromFile(scriptFile), k, (nextExp) -> { Reader.readAndProcess(Stream.fromFile(scriptFile), k, (nextExp) -> {
var expr = Kiss.readerExpToHaxeExpr(nextExp, k); var expr = Kiss.readerExpToHaxeExpr(nextExp, k);
@@ -78,6 +79,8 @@ class EmbeddedScript {
// i.e. knot declarations need to end the previous knot, and BELOW that set a label for the new one, then increment the read count // i.e. knot declarations need to end the previous knot, and BELOW that set a label for the new one, then increment the read count
// TODO test await // TODO test await
}); });
null;
});
classFields.push({ classFields.push({
pos: PositionTools.make({ pos: PositionTools.make({

View File

@@ -121,7 +121,7 @@ class Kiss {
return k; return k;
} }
static function _try<T>(operation:() -> T):Null<T> { public static function _try<T>(operation:() -> T):Null<T> {
#if !macrotest #if !macrotest
try { try {
#end #end