SIRPopExpression oldPrevPop = prevPop; prevPop = null;
SIRPopExpression prevPop = null;
    public Object visitBlockStatement(JBlock self,            JavaStyleComment[] comments) {        SIRPopExpression oldPrevPop = prevPop;        prevPop = null;                JBlock newBlock = (JBlock)super.visitBlockStatement(self,comments);                List /*<JStatement>*/ oldStatements = newBlock.getStatements();        List /*<JStatement>*/ simplifiedStatements = new LinkedList();        int numDecls = 0;        for (Iterator i = oldStatements.iterator(); i.hasNext();) {            Object o = i.next();            if (o != null && !(o instanceof JEmptyStatement)) {                if ((o instanceof JExpressionStatement) &&                    ((JExpressionStatement)(o)).getExpression() instanceof                     SIRPopExpression) {                    // found a pop.                      SIRPopExpression popExpr = (SIRPopExpression)((JExpressionStatement)o).getExpression();                    if (prevPop != null) {                        //combine with immediately previous pop if any                         prevPop.setNumPop(popExpr.getNumPop() + prevPop.getNumPop());                        continue;                    } else {                        // no immediately previous pop in block, but this                        // could be previous for the next statement.                        prevPop = popExpr;                        simplifiedStatements.add(o);                        continue;                    } // assert false : "execution does not get here";                }                 prevPop = null;                simplifiedStatements.add(o);                if (o instanceof JVariableDeclarationStatement) {                numDecls++;                }            }        }        // restore previous pop outside of block        prevPop = oldPrevPop;        // empty block becomes empty statement for surrounding block to elide        int newLen = simplifiedStatements.size();        if (newLen - numDecls == 0) {            // nothing except declarations which should have no effect outside block            return new JEmptyStatement();        }        if (newLen == 1) {            // single statment (not declation)            return simplifiedStatements.get(0);        } else if (newLen == oldStatements.size()) {            // same length: this loop only deletes never changes            return newBlock;        }        return new JBlock(newBlock.getTokenReference(),                simplifiedStatements,newBlock.getComments());    }