Java Code Examples for com.google.javascript.rhino.Node#isDo()

The following examples show how to use com.google.javascript.rhino.Node#isDo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Closure_34_CodeGenerator_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * @return Whether the Node is a DO or FUNCTION (with or without
 * labels).
 */
private boolean isOneExactlyFunctionOrDo(Node n) {
  if (n.isLabel()) {
    Node labeledStatement = n.getLastChild();
    if (!labeledStatement.isBlock()) {
      return isOneExactlyFunctionOrDo(labeledStatement);
    } else {
      // For labels with block children, we need to ensure that a
      // labeled FUNCTION or DO isn't generated when extraneous BLOCKs
      // are skipped.
      if (getNonEmptyChildCount(n, 2) == 1) {
        return isOneExactlyFunctionOrDo(getFirstNonEmptyChild(n));
      } else {
        // Either a empty statement or an block with more than one child,
        // way it isn't a FUNCTION or DO.
        return false;
      }
    }
  } else {
    return (n.isFunction() || n.isDo());
  }
}
 
Example 2
Source File: Closure_34_CodeGenerator_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * @return Whether the Node is a DO or FUNCTION (with or without
 * labels).
 */
private boolean isOneExactlyFunctionOrDo(Node n) {
  if (n.isLabel()) {
    Node labeledStatement = n.getLastChild();
    if (!labeledStatement.isBlock()) {
      return isOneExactlyFunctionOrDo(labeledStatement);
    } else {
      // For labels with block children, we need to ensure that a
      // labeled FUNCTION or DO isn't generated when extraneous BLOCKs
      // are skipped.
      if (getNonEmptyChildCount(n, 2) == 1) {
        return isOneExactlyFunctionOrDo(getFirstNonEmptyChild(n));
      } else {
        // Either a empty statement or an block with more than one child,
        // way it isn't a FUNCTION or DO.
        return false;
      }
    }
  } else {
    return (n.isFunction() || n.isDo());
  }
}
 
Example 3
Source File: Closure_123_CodeGenerator_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * @return Whether the Node is a DO or FUNCTION (with or without
 * labels).
 */
private boolean isOneExactlyFunctionOrDo(Node n) {
  if (n.isLabel()) {
    Node labeledStatement = n.getLastChild();
    if (!labeledStatement.isBlock()) {
      return isOneExactlyFunctionOrDo(labeledStatement);
    } else {
      // For labels with block children, we need to ensure that a
      // labeled FUNCTION or DO isn't generated when extraneous BLOCKs
      // are skipped.
      if (getNonEmptyChildCount(n, 2) == 1) {
        return isOneExactlyFunctionOrDo(getFirstNonEmptyChild(n));
      } else {
        // Either a empty statement or an block with more than one child,
        // way it isn't a FUNCTION or DO.
        return false;
      }
    }
  } else {
    return (n.isFunction() || n.isDo());
  }
}
 
Example 4
Source File: Closure_123_CodeGenerator_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * @return Whether the Node is a DO or FUNCTION (with or without
 * labels).
 */
private boolean isOneExactlyFunctionOrDo(Node n) {
  if (n.isLabel()) {
    Node labeledStatement = n.getLastChild();
    if (!labeledStatement.isBlock()) {
      return isOneExactlyFunctionOrDo(labeledStatement);
    } else {
      // For labels with block children, we need to ensure that a
      // labeled FUNCTION or DO isn't generated when extraneous BLOCKs
      // are skipped.
      if (getNonEmptyChildCount(n, 2) == 1) {
        return isOneExactlyFunctionOrDo(getFirstNonEmptyChild(n));
      } else {
        // Either a empty statement or an block with more than one child,
        // way it isn't a FUNCTION or DO.
        return false;
      }
    }
  } else {
    return (n.isFunction() || n.isDo());
  }
}
 
Example 5
Source File: Closure_128_CodeGenerator_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * @return Whether the Node is a DO or FUNCTION (with or without
 * labels).
 */
private boolean isOneExactlyFunctionOrDo(Node n) {
  if (n.isLabel()) {
    Node labeledStatement = n.getLastChild();
    if (!labeledStatement.isBlock()) {
      return isOneExactlyFunctionOrDo(labeledStatement);
    } else {
      // For labels with block children, we need to ensure that a
      // labeled FUNCTION or DO isn't generated when extraneous BLOCKs
      // are skipped.
      if (getNonEmptyChildCount(n, 2) == 1) {
        return isOneExactlyFunctionOrDo(getFirstNonEmptyChild(n));
      } else {
        // Either a empty statement or an block with more than one child,
        // way it isn't a FUNCTION or DO.
        return false;
      }
    }
  } else {
    return (n.isFunction() || n.isDo());
  }
}
 
Example 6
Source File: Closure_128_CodeGenerator_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * @return Whether the Node is a DO or FUNCTION (with or without
 * labels).
 */
private boolean isOneExactlyFunctionOrDo(Node n) {
  if (n.isLabel()) {
    Node labeledStatement = n.getLastChild();
    if (!labeledStatement.isBlock()) {
      return isOneExactlyFunctionOrDo(labeledStatement);
    } else {
      // For labels with block children, we need to ensure that a
      // labeled FUNCTION or DO isn't generated when extraneous BLOCKs
      // are skipped.
      if (getNonEmptyChildCount(n, 2) == 1) {
        return isOneExactlyFunctionOrDo(getFirstNonEmptyChild(n));
      } else {
        // Either a empty statement or an block with more than one child,
        // way it isn't a FUNCTION or DO.
        return false;
      }
    }
  } else {
    return (n.isFunction() || n.isDo());
  }
}
 
Example 7
Source File: CodeGenerator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @return Whether the Node is a DO or FUNCTION (with or without
 * labels).
 */
private boolean isOneExactlyFunctionOrDo(Node n) {
  if (n.isLabel()) {
    Node labeledStatement = n.getLastChild();
    if (!labeledStatement.isBlock()) {
      return isOneExactlyFunctionOrDo(labeledStatement);
    } else {
      // For labels with block children, we need to ensure that a
      // labeled FUNCTION or DO isn't generated when extraneous BLOCKs
      // are skipped.
      if (getNonEmptyChildCount(n, 2) == 1) {
        return isOneExactlyFunctionOrDo(getFirstNonEmptyChild(n));
      } else {
        // Either a empty statement or an block with more than one child,
        // way it isn't a FUNCTION or DO.
        return false;
      }
    }
  } else {
    return (n.isFunction() || n.isDo());
  }
}
 
Example 8
Source File: Cardumen_00149_t.java    From coming with MIT License 5 votes vote down vote up
static boolean mayBeString(Node n, boolean recurse) {
  if ((n.isDo()) && ((n.getLastChild()) == n)) {
    return allResultsMatch(n, MAY_BE_STRING_PREDICATE);
  } else {
    return mayBeStringHelper(n);
  }
}