EmbeddedScript and AsyncEmbeddedScript use _try() when building
This commit is contained in:
@@ -61,22 +61,25 @@ class AsyncEmbeddedScript {
|
||||
|
||||
scriptFile = Path.join([loadingDirectory, scriptFile]);
|
||||
k.fieldList = [];
|
||||
Reader.readAndProcess(Stream.fromFile(scriptFile), k, (nextExp) -> {
|
||||
var exprString = Reader.toString(nextExp.def);
|
||||
var expr = Kiss.readerExpToHaxeExpr(nextExp, k);
|
||||
Kiss._try(() -> {
|
||||
Reader.readAndProcess(Stream.fromFile(scriptFile), k, (nextExp) -> {
|
||||
var exprString = Reader.toString(nextExp.def);
|
||||
var expr = Kiss.readerExpToHaxeExpr(nextExp, k);
|
||||
|
||||
#if debug
|
||||
expr = macro { trace($v{exprString}); $expr; };
|
||||
#end
|
||||
#if debug
|
||||
expr = macro { trace($v{exprString}); $expr; };
|
||||
#end
|
||||
|
||||
if (expr != null) {
|
||||
commandList.push(macro function(self, cc) {
|
||||
$expr;
|
||||
});
|
||||
}
|
||||
if (expr != null) {
|
||||
commandList.push(macro function(self, cc) {
|
||||
$expr;
|
||||
});
|
||||
}
|
||||
|
||||
// This return is essential for type unification of concat() and push() above... ugh.
|
||||
return;
|
||||
// This return is essential for type unification of concat() and push() above... ugh.
|
||||
return;
|
||||
});
|
||||
null;
|
||||
});
|
||||
|
||||
classFields = classFields.concat(k.fieldList);
|
||||
|
@@ -62,21 +62,24 @@ class EmbeddedScript {
|
||||
classFields = classFields.concat(Kiss.build(dslFile, k));
|
||||
scriptFile = Path.join([loadingDirectory, scriptFile]);
|
||||
|
||||
Reader.readAndProcess(Stream.fromFile(scriptFile), k, (nextExp) -> {
|
||||
var expr = Kiss.readerExpToHaxeExpr(nextExp, k);
|
||||
Kiss._try(() -> {
|
||||
Reader.readAndProcess(Stream.fromFile(scriptFile), k, (nextExp) -> {
|
||||
var expr = Kiss.readerExpToHaxeExpr(nextExp, k);
|
||||
|
||||
if (expr != null) {
|
||||
commandList.push(macro function(self) {
|
||||
$expr;
|
||||
});
|
||||
}
|
||||
if (expr != null) {
|
||||
commandList.push(macro function(self) {
|
||||
$expr;
|
||||
});
|
||||
}
|
||||
|
||||
// This return is essential for type unification of concat() and push() above... ugh.
|
||||
return;
|
||||
// TODO also allow label setting and multiple commands coming from the same expr?
|
||||
// Multiple things could come from the same expr by returning begin, or a call to a function that does more stuff
|
||||
// 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
|
||||
// This return is essential for type unification of concat() and push() above... ugh.
|
||||
return;
|
||||
// TODO also allow label setting and multiple commands coming from the same expr?
|
||||
// Multiple things could come from the same expr by returning begin, or a call to a function that does more stuff
|
||||
// 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
|
||||
});
|
||||
null;
|
||||
});
|
||||
|
||||
classFields.push({
|
||||
|
@@ -121,7 +121,7 @@ class Kiss {
|
||||
return k;
|
||||
}
|
||||
|
||||
static function _try<T>(operation:() -> T):Null<T> {
|
||||
public static function _try<T>(operation:() -> T):Null<T> {
|
||||
#if !macrotest
|
||||
try {
|
||||
#end
|
||||
|
Reference in New Issue
Block a user