docs: public void clear() {
          if (stateStack.size()>1) {
              int size = stateStack.size()-1;
              throw new GroovyBugError("the compile stack contains "+size+" more push instruction"+(size==1?"":"s")+" than pops.");
          }
          if (lhsStack.size()>1) {
              int size = lhsStack.size()-1;
              throw new GroovyBugError("lhs stack is supposed to be empty, but has " +
                                       size + " elements left.");
          }
          if (implicitThisStack.size()>1) {
              int size = implicitThisStack.size()-1;
              throw new GroovyBugError("implicit 'this' stack is supposed to be empty, but has " +
                                       size + " elements left.");
          }
          clear = true;
          MethodVisitor mv = controller.getMethodVisitor();
          // br experiment with local var table so debuggers can retrieve variable names
          if (true) {//AsmClassGenerator.CREATE_DEBUG_INFO) {
              if (thisEndLabel==null) setEndLabels();
  
              if (!scope.isInStaticContext()) {
                  // write "this"
                  mv.visitLocalVariable("this", className, null, thisStartLabel, thisEndLabel, 0);
              }
  
              for (Iterator iterator = usedVariables.iterator(); iterator.hasNext();) {
                  BytecodeVariable v = (BytecodeVariable) iterator.next();
                  ClassNode t = v.getType();
                  if (v.isHolder()) t = ClassHelper.REFERENCE_TYPE;
                  String type = BytecodeHelper.getTypeDescription(t);
                  Label start = v.getStartLabel();
                  Label end = v.getEndLabel();
                  mv.visitLocalVariable(v.getName(), type, null, start, end, v.getIndex());
              }
          }
  
          //exception table writing
          for (ExceptionTableEntry ep : typedExceptions) {
              mv.visitTryCatchBlock(ep.start, ep.end, ep.goal, ep.sig);
          }
          //exception table writing
          for (ExceptionTableEntry ep : untypedExceptions) {
              mv.visitTryCatchBlock(ep.start, ep.end, ep.goal, ep.sig);
          }
  
  
          pop();
          typedExceptions.clear();
          untypedExceptions.clear();
          stackVariables.clear();
          usedVariables.clear();
          scope = null;
          finallyBlocks.clear();
          resetVariableIndex(false);
          superBlockNamedLabels.clear();
          currentBlockNamedLabels.clear();
          namedLoopBreakLabel.clear();
          namedLoopContinueLabel.clear();
          continueLabel=null;
          breakLabel=null;
          thisStartLabel=null;
          thisEndLabel=null;
          mv = null;
      }