From 3599a6cc2d3ca64136ab1976ff5cb29af64867a0 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sat, 10 Feb 2024 11:33:03 -0700 Subject: [PATCH] fix whitespace --- src/kiss/AsyncEmbeddedScript2.hx | 30 +++++++++++++++--------------- src/test/cases/DSLTestCase.hx | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/kiss/AsyncEmbeddedScript2.hx b/src/kiss/AsyncEmbeddedScript2.hx index 78a15d9..231a2b9 100644 --- a/src/kiss/AsyncEmbeddedScript2.hx +++ b/src/kiss/AsyncEmbeddedScript2.hx @@ -30,10 +30,10 @@ typedef AsyncCommand2 = (AsyncEmbeddedScript2, Bool, Continuation2) -> Void; class ObjectInterp2 extends Interp { var obj:T; - var fields:Map = []; + var fields:Map = []; public function new(obj:T) { this.obj = obj; - + for (field in Type.getInstanceFields(Type.getClass(obj))) { fields[field] = true; } @@ -59,7 +59,7 @@ class ObjectInterp2 extends Interp { super.setVar(name, v); } } - + public override function expr( e : hscript.Expr ) : Dynamic { var curExpr = e; #if hscriptPos @@ -113,7 +113,7 @@ class AsyncEmbeddedScript2 { return interp.variables; } - private var hscriptInstructions:Map = []; + private var hscriptInstructions:Map = []; private function hscriptInstructionFile() return ""; public function setBreakHandler(handler:AsyncCommand2) { @@ -146,7 +146,7 @@ class AsyncEmbeddedScript2 { private function resetInstructions() {} - public function instructionCount() { + public function instructionCount() { if (instructions == null) resetInstructions(); return instructions.length; @@ -169,7 +169,7 @@ class AsyncEmbeddedScript2 { public var skipTarget(default, null):Null = null; public var running(default, null):Bool = false; - + // There are two ways to keep the callstack unwound. The default is to use haxe.Timer.delay, // which is automatic, but might introduce frame-skippy behaviors. The alternative is to // set unwindWithTimerDelay to false, and use your own event loop to call ccToCall whenever @@ -179,7 +179,7 @@ class AsyncEmbeddedScript2 { public var onSkipStart(default, null):Continuation2 = null; public var onSkipEnd(default, null):Continuation2 = null; - + // When skipping, you might end up with hundreds of instructions running in a single frame. // This flag forces the skipped instructions to run one-per-frame so your program doesn't hang. public var skipAsync(default, null):Bool = false; @@ -206,7 +206,7 @@ class AsyncEmbeddedScript2 { skipping = true; } } - + lastInstructionPointer = instructionPointer; if (instructions == null) resetInstructions(); @@ -284,7 +284,7 @@ class AsyncEmbeddedScript2 { public var lastLabel(default, null):String = ""; private var potentialLastLabel:String = ""; - + // Will be called EVERY time a label is reached, even if skipping past it: public var onLabel:String->Void; // Will be called when labels are reached without skipping, AND on the last label skipped when skipping ends @@ -396,12 +396,12 @@ class AsyncEmbeddedScript2 { #end case Symbol(label) | StrExp(label): k.stateChanged = true; - + label = '${++labelNum}. '.lpad("0", 5) + label; labelsList.push(macro labels[$v{label}] = $v{commandList.length}); - + var b = wholeExp.expBuilder(); - + b.begin([ b._if(b.symbol("skipping"), b.set(b.symbol("potentialLastLabel"), b.str(label)), @@ -450,7 +450,7 @@ class AsyncEmbeddedScript2 { } scriptFile = Path.join([loadingDirectory, scriptFile]); - + Context.registerModuleDependency(Context.getLocalModule(), scriptFile); k.fieldList = []; Kiss._try(() -> { @@ -469,10 +469,10 @@ class AsyncEmbeddedScript2 { nextExp = Kiss.macroExpand(nextExp, k); var stateChanged = k.stateChanged; - + // Allow packing multiple commands into one exp with a (commands <...>) statement switch (nextExp.def) { - case CallExp({pos: _, def: Symbol("commands")}, + case CallExp({pos: _, def: Symbol("commands")}, commands): for (exp in commands) { process(exp); diff --git a/src/test/cases/DSLTestCase.hx b/src/test/cases/DSLTestCase.hx index f170fcc..7123ccd 100644 --- a/src/test/cases/DSLTestCase.hx +++ b/src/test/cases/DSLTestCase.hx @@ -26,7 +26,7 @@ class DSLTestCase extends Test { Assert.isFalse(script.ranHscriptInstruction); Assert.isTrue(script.wholeScriptDone); } - + #if (sys || hxnodejs) function testAsyncFromCache() { var script = new AsyncDSLScriptThatWillCache();