@Override
 public void visit(Block obj) {
   preVisitVisitor(obj);
   visitNodes(obj.getStatements());
   visitNodes(obj.getExceptionStatements());
   postVisitVisitor(obj);
 }
  public void resolveBlock(
      CreateProcedureCommand command,
      Block block,
      GroupContext originalExternalGroups,
      TempMetadataAdapter original)
      throws QueryResolverException, QueryMetadataException, TeiidComponentException {
    LogManager.logTrace(
        org.teiid.logging.LogConstants.CTX_QUERY_RESOLVER,
        new Object[] {"Resolving block", block}); // $NON-NLS-1$

    // create a new variable and metadata context for this block so that discovered metadata is not
    // visible else where
    TempMetadataStore store = original.getMetadataStore().clone();
    TempMetadataAdapter metadata = new TempMetadataAdapter(original.getMetadata(), store);
    GroupContext externalGroups = new GroupContext(originalExternalGroups, null);

    // create a new variables group for this block
    GroupSymbol variables =
        ProcedureContainerResolver.addScalarGroup(
            ProcedureReservedWords.VARIABLES, store, externalGroups, new LinkedList<Expression>());

    for (Statement statement : block.getStatements()) {
      resolveStatement(command, statement, externalGroups, variables, metadata);
    }

    if (block.getExceptionGroup() != null) {
      // create a new variable and metadata context for this block so that discovered metadata is
      // not visible else where
      store = original.getMetadataStore().clone();
      metadata = new TempMetadataAdapter(original.getMetadata(), store);
      externalGroups = new GroupContext(originalExternalGroups, null);

      // create a new variables group for this block
      variables =
          ProcedureContainerResolver.addScalarGroup(
              ProcedureReservedWords.VARIABLES,
              store,
              externalGroups,
              new LinkedList<Expression>());
      isValidGroup(metadata, block.getExceptionGroup());

      if (block.getExceptionStatements() != null) {
        ProcedureContainerResolver.addScalarGroup(
            block.getExceptionGroup(), store, externalGroups, exceptionGroup, false);
        for (Statement statement : block.getExceptionStatements()) {
          resolveStatement(command, statement, externalGroups, variables, metadata);
        }
      }
    }
  }