rt/vm/src/main/java/org/apidesign/vm4brwsr/StackMapper.java
branchReducedStack
changeset 1466 39d26d3686d9
parent 1457 b9386cc3ff7b
child 1467 5538c1eb03be
     1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/StackMapper.java	Sat Feb 15 20:18:26 2014 +0100
     1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/StackMapper.java	Mon Feb 17 07:54:35 2014 +0100
     1.3 @@ -84,7 +84,7 @@
     1.4      void flush(Appendable out) throws IOException {
     1.5          int count = stackTypeIndexPairs.getSize();
     1.6          for (int i = 0; i < count; i++) {
     1.7 -            String val = stackValues.getAndClear(i);
     1.8 +            String val = stackValues.getAndClear(i, true);
     1.9              if (val == null) {
    1.10                  continue;
    1.11              }
    1.12 @@ -160,6 +160,9 @@
    1.13      }
    1.14  
    1.15      public CharSequence getT(final int indexFromTop, final int type) {
    1.16 +        return getT(indexFromTop, type, true);
    1.17 +    }
    1.18 +    public CharSequence getT(final int indexFromTop, final int type, boolean clear) {
    1.19          final int stackSize = stackTypeIndexPairs.getSize();
    1.20          if (indexFromTop >= stackSize) {
    1.21              throw new IllegalStateException("Stack underflow");
    1.22 @@ -170,7 +173,7 @@
    1.23              throw new IllegalStateException("Type mismatch");
    1.24          }
    1.25          String value =
    1.26 -                stackValues.getAndClear(stackSize - indexFromTop - 1);
    1.27 +            stackValues.getAndClear(stackSize - indexFromTop - 1, clear);
    1.28          if (value != null) {
    1.29              return value;
    1.30          }