code: public static AstNumList check(long dstX, AstRoot ast) {
      // Sanity check vs dst.  To simplify logic, jam the 1 col/row case in as a AstNumList
      AstNumList dim;
      if (ast instanceof AstNumList) dim = (AstNumList) ast;
      else if (ast instanceof AstNum) dim = new AstNumList(((AstNum) ast).getNum());
      else throw new IllegalArgumentException("Requires a number-list, but found a " + ast.getClass());
      if (dim.isEmpty()) return dim; // Allow empty
      for (int col : dim.expand4())
        if (!(0 <= col && col < dstX))
          throw new IllegalArgumentException("Selection must be an integer from 0 to " + dstX);
      return dim;
    }
docs: Argument check helper