From 43b3539843951e6b83c418161a0bf79b3e3045b3 Mon Sep 17 00:00:00 2001 From: Niall Gallagher Date: Tue, 13 Dec 2016 00:00:54 +0000 Subject: [PATCH] Add additional notes --- .../org/snapscript/core/stack/CompoundStatement2.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/snap-core/src/test/java/org/snapscript/core/stack/CompoundStatement2.java b/snap-core/src/test/java/org/snapscript/core/stack/CompoundStatement2.java index 43c69eb0..bc424cb7 100644 --- a/snap-core/src/test/java/org/snapscript/core/stack/CompoundStatement2.java +++ b/snap-core/src/test/java/org/snapscript/core/stack/CompoundStatement2.java @@ -32,7 +32,7 @@ public Result compile(Scope scope) throws Exception { Result result = statement.compile(scope); if(result.isDeclare()){ - depth.getAndIncrement(); + depth.getAndIncrement(); // this is probably not too useful } } } finally { @@ -44,7 +44,9 @@ public Result compile(Scope scope) throws Exception { public Result execute(Scope2 scope) throws Exception { Result last = ResultType.getNormal(); State2 state2 = scope.getStack(); - State2 next = state2.create(); // allow the stack to grow in a compound statement!! + //int size = state2.size(); // how many will be allocated + + if(!compile.get()) { throw new InternalStateException("Statement was not compiled"); @@ -59,7 +61,9 @@ public Result execute(Scope2 scope) throws Exception { last = result; } }finally { - next.clear(); + //state2.reset(size); // we cannot create a new stack frame, we just remove variables created + // // this is because a compound scope has access to all variables in + // // in the stack... } return last; }