AsyncEmbeddedScript2 auto-spaced labels
This commit is contained in:
@@ -373,7 +373,7 @@ class AsyncEmbeddedScript2 {
|
|||||||
public var onError:(Any,Continuation2,Continuation2)->Void;
|
public var onError:(Any,Continuation2,Continuation2)->Void;
|
||||||
|
|
||||||
#if macro
|
#if macro
|
||||||
public static function build(dslHaxelib:String, dslFile:String, scriptFile:String):Array<Field> {
|
public static function build(dslHaxelib:String, dslFile:String, scriptFile:String, autoLabelInterval:Int=10):Array<Field> {
|
||||||
// trace('AsyncEmbeddedScript.build $dslHaxelib $dslFile $scriptFile');
|
// trace('AsyncEmbeddedScript.build $dslHaxelib $dslFile $scriptFile');
|
||||||
var k = Kiss.defaultKissState();
|
var k = Kiss.defaultKissState();
|
||||||
|
|
||||||
@@ -469,11 +469,13 @@ class AsyncEmbeddedScript2 {
|
|||||||
|
|
||||||
Context.registerModuleDependency(Context.getLocalModule(), scriptFile);
|
Context.registerModuleDependency(Context.getLocalModule(), scriptFile);
|
||||||
k.fieldList = [];
|
k.fieldList = [];
|
||||||
|
|
||||||
|
var lastLabelIp = 0;
|
||||||
Kiss._try(() -> {
|
Kiss._try(() -> {
|
||||||
#if profileKiss
|
#if profileKiss
|
||||||
Kiss.measure('Compiling kiss: $scriptFile', () -> {
|
Kiss.measure('Compiling kiss: $scriptFile', () -> {
|
||||||
#end
|
#end
|
||||||
function process(nextExp) {
|
function process(nextExp:ReaderExp) {
|
||||||
#if (kissCache && !lua)
|
#if (kissCache && !lua)
|
||||||
var cacheKey = Reader.toString(nextExp.def);
|
var cacheKey = Reader.toString(nextExp.def);
|
||||||
if (cache.exists(cacheKey)) {
|
if (cache.exists(cacheKey)) {
|
||||||
@@ -483,6 +485,13 @@ class AsyncEmbeddedScript2 {
|
|||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
// Automatic evenly spaced labels!
|
||||||
|
if (autoLabelInterval > 0 && commandList.length > lastLabelIp + autoLabelInterval){
|
||||||
|
var b = nextExp.expBuilder();
|
||||||
|
lastLabelIp = commandList.length;
|
||||||
|
process(b.callSymbol("label", [b.symbol("auto")]));
|
||||||
|
}
|
||||||
|
|
||||||
nextExp = Kiss._try(()->Kiss.macroExpand(nextExp, k));
|
nextExp = Kiss._try(()->Kiss.macroExpand(nextExp, k));
|
||||||
if (nextExp == null) return;
|
if (nextExp == null) return;
|
||||||
var stateChanged = k.stateChanged;
|
var stateChanged = k.stateChanged;
|
||||||
|
Reference in New Issue
Block a user