Java Code Examples for com.google.javascript.rhino.jstype.JSType#matchesStringContext()

The following examples show how to use com.google.javascript.rhino.jstype.JSType#matchesStringContext() . 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_117_TypeValidator_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Expect the type to be a number or string, or a type convertible to a number
 * or string. If the expectation is not met, issue a warning at the provided
 * node's source code position.
 */
void expectStringOrNumber(
    NodeTraversal t, Node n, JSType type, String msg) {
  if (!type.matchesNumberContext() && !type.matchesStringContext()) {
    mismatch(t, n, msg, type, NUMBER_STRING);
  }
}
 
Example 2
Source File: Closure_117_TypeValidator_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Expect the type to be a number or string, or a type convertible to a number
 * or string. If the expectation is not met, issue a warning at the provided
 * node's source code position.
 */
void expectStringOrNumber(
    NodeTraversal t, Node n, JSType type, String msg) {
  if (!type.matchesNumberContext() && !type.matchesStringContext()) {
    mismatch(t, n, msg, type, NUMBER_STRING);
  }
}
 
Example 3
Source File: Closure_6_TypeValidator_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Expect the type to be a number or string, or a type convertible to a number
 * or string. If the expectation is not met, issue a warning at the provided
 * node's source code position.
 */
void expectStringOrNumber(
    NodeTraversal t, Node n, JSType type, String msg) {
  if (!type.matchesNumberContext() && !type.matchesStringContext()) {
    mismatch(t, n, msg, type, NUMBER_STRING);
  }
}
 
Example 4
Source File: Closure_6_TypeValidator_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Expect the type to be a number or string, or a type convertible to a number
 * or string. If the expectation is not met, issue a warning at the provided
 * node's source code position.
 */
void expectStringOrNumber(
    NodeTraversal t, Node n, JSType type, String msg) {
  if (!type.matchesNumberContext() && !type.matchesStringContext()) {
    mismatch(t, n, msg, type, NUMBER_STRING);
  }
}
 
Example 5
Source File: TypeValidator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Expect the type to be a number or string, or a type convertible to a number
 * or string. If the expectation is not met, issue a warning at the provided
 * node's source code position.
 */
void expectStringOrNumber(
    NodeTraversal t, Node n, JSType type, String msg) {
  if (!type.matchesNumberContext() && !type.matchesStringContext()) {
    mismatch(t, n, msg, type, NUMBER_STRING);
  }
}
 
Example 6
Source File: Closure_117_TypeValidator_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Expect the type to be a string, or a type convertible to string. If the
 * expectation is not met, issue a warning at the provided node's source code
 * position.
 */
void expectString(NodeTraversal t, Node n, JSType type, String msg) {
  if (!type.matchesStringContext()) {
    mismatch(t, n, msg, type, STRING_TYPE);
  }
}
 
Example 7
Source File: Closure_117_TypeValidator_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Expect the type to be a string, or a type convertible to string. If the
 * expectation is not met, issue a warning at the provided node's source code
 * position.
 */
void expectString(NodeTraversal t, Node n, JSType type, String msg) {
  if (!type.matchesStringContext()) {
    mismatch(t, n, msg, type, STRING_TYPE);
  }
}
 
Example 8
Source File: Closure_6_TypeValidator_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Expect the type to be a string, or a type convertible to string. If the
 * expectation is not met, issue a warning at the provided node's source code
 * position.
 */
void expectString(NodeTraversal t, Node n, JSType type, String msg) {
  if (!type.matchesStringContext()) {
    mismatch(t, n, msg, type, STRING_TYPE);
  }
}
 
Example 9
Source File: Closure_6_TypeValidator_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Expect the type to be a string, or a type convertible to string. If the
 * expectation is not met, issue a warning at the provided node's source code
 * position.
 */
void expectString(NodeTraversal t, Node n, JSType type, String msg) {
  if (!type.matchesStringContext()) {
    mismatch(t, n, msg, type, STRING_TYPE);
  }
}
 
Example 10
Source File: TypeValidator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Expect the type to be a string, or a type convertible to string. If the
 * expectation is not met, issue a warning at the provided node's source code
 * position.
 */
void expectString(NodeTraversal t, Node n, JSType type, String msg) {
  if (!type.matchesStringContext()) {
    mismatch(t, n, msg, type, STRING_TYPE);
  }
}