Java Code Examples for com.google.javascript.rhino.Token#REF_SPECIAL

The following examples show how to use com.google.javascript.rhino.Token#REF_SPECIAL . 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_70_TypedScopeCreator_t.java    From coming with MIT License 4 votes vote down vote up
private void attachLiteralTypes(NodeTraversal t, Node n) {
  switch (n.getType()) {
    case Token.NULL:
      n.setJSType(getNativeType(NULL_TYPE));
      break;

    case Token.VOID:
      n.setJSType(getNativeType(VOID_TYPE));
      break;

    case Token.STRING:
      // Defer keys to the Token.OBJECTLIT case
      if (!NodeUtil.isObjectLitKey(n, n.getParent())) {
        n.setJSType(getNativeType(STRING_TYPE));
      }
      break;

    case Token.NUMBER:
      n.setJSType(getNativeType(NUMBER_TYPE));
      break;

    case Token.TRUE:
    case Token.FALSE:
      n.setJSType(getNativeType(BOOLEAN_TYPE));
      break;

    case Token.REGEXP:
      n.setJSType(getNativeType(REGEXP_TYPE));
      break;

    case Token.REF_SPECIAL:
      n.setJSType(getNativeType(UNKNOWN_TYPE));
      break;

    case Token.OBJECTLIT:
      defineObjectLiteral(t, n);
      break;

      // NOTE(nicksantos): If we ever support Array tuples,
      // we will need to put ARRAYLIT here as well.
  }
}
 
Example 2
Source File: Closure_70_TypedScopeCreator_s.java    From coming with MIT License 4 votes vote down vote up
private void attachLiteralTypes(NodeTraversal t, Node n) {
  switch (n.getType()) {
    case Token.NULL:
      n.setJSType(getNativeType(NULL_TYPE));
      break;

    case Token.VOID:
      n.setJSType(getNativeType(VOID_TYPE));
      break;

    case Token.STRING:
      // Defer keys to the Token.OBJECTLIT case
      if (!NodeUtil.isObjectLitKey(n, n.getParent())) {
        n.setJSType(getNativeType(STRING_TYPE));
      }
      break;

    case Token.NUMBER:
      n.setJSType(getNativeType(NUMBER_TYPE));
      break;

    case Token.TRUE:
    case Token.FALSE:
      n.setJSType(getNativeType(BOOLEAN_TYPE));
      break;

    case Token.REGEXP:
      n.setJSType(getNativeType(REGEXP_TYPE));
      break;

    case Token.REF_SPECIAL:
      n.setJSType(getNativeType(UNKNOWN_TYPE));
      break;

    case Token.OBJECTLIT:
      defineObjectLiteral(t, n);
      break;

      // NOTE(nicksantos): If we ever support Array tuples,
      // we will need to put ARRAYLIT here as well.
  }
}
 
Example 3
Source File: Closure_54_TypedScopeCreator_s.java    From coming with MIT License 4 votes vote down vote up
private void attachLiteralTypes(NodeTraversal t, Node n) {
  switch (n.getType()) {
    case Token.NULL:
      n.setJSType(getNativeType(NULL_TYPE));
      break;

    case Token.VOID:
      n.setJSType(getNativeType(VOID_TYPE));
      break;

    case Token.STRING:
      // Defer keys to the Token.OBJECTLIT case
      if (!NodeUtil.isObjectLitKey(n, n.getParent())) {
        n.setJSType(getNativeType(STRING_TYPE));
      }
      break;

    case Token.NUMBER:
      n.setJSType(getNativeType(NUMBER_TYPE));
      break;

    case Token.TRUE:
    case Token.FALSE:
      n.setJSType(getNativeType(BOOLEAN_TYPE));
      break;

    case Token.REGEXP:
      n.setJSType(getNativeType(REGEXP_TYPE));
      break;

    case Token.REF_SPECIAL:
      n.setJSType(getNativeType(UNKNOWN_TYPE));
      break;

    case Token.OBJECTLIT:
      defineObjectLiteral(t, n);
      break;

      // NOTE(nicksantos): If we ever support Array tuples,
      // we will need to put ARRAYLIT here as well.
  }
}
 
Example 4
Source File: Closure_54_TypedScopeCreator_t.java    From coming with MIT License 4 votes vote down vote up
private void attachLiteralTypes(NodeTraversal t, Node n) {
  switch (n.getType()) {
    case Token.NULL:
      n.setJSType(getNativeType(NULL_TYPE));
      break;

    case Token.VOID:
      n.setJSType(getNativeType(VOID_TYPE));
      break;

    case Token.STRING:
      // Defer keys to the Token.OBJECTLIT case
      if (!NodeUtil.isObjectLitKey(n, n.getParent())) {
        n.setJSType(getNativeType(STRING_TYPE));
      }
      break;

    case Token.NUMBER:
      n.setJSType(getNativeType(NUMBER_TYPE));
      break;

    case Token.TRUE:
    case Token.FALSE:
      n.setJSType(getNativeType(BOOLEAN_TYPE));
      break;

    case Token.REGEXP:
      n.setJSType(getNativeType(REGEXP_TYPE));
      break;

    case Token.REF_SPECIAL:
      n.setJSType(getNativeType(UNKNOWN_TYPE));
      break;

    case Token.OBJECTLIT:
      defineObjectLiteral(t, n);
      break;

      // NOTE(nicksantos): If we ever support Array tuples,
      // we will need to put ARRAYLIT here as well.
  }
}
 
Example 5
Source File: Closure_95_TypedScopeCreator_s.java    From coming with MIT License 4 votes vote down vote up
private void attachLiteralTypes(Node n) {
  switch (n.getType()) {
    case Token.NULL:
      n.setJSType(getNativeType(NULL_TYPE));
      break;

    case Token.VOID:
      n.setJSType(getNativeType(VOID_TYPE));
      break;

    case Token.STRING:
      n.setJSType(getNativeType(STRING_TYPE));
      break;

    case Token.NUMBER:
      n.setJSType(getNativeType(NUMBER_TYPE));
      break;

    case Token.TRUE:
    case Token.FALSE:
      n.setJSType(getNativeType(BOOLEAN_TYPE));
      break;

    case Token.REGEXP:
      n.setJSType(getNativeType(REGEXP_TYPE));
      break;

    case Token.REF_SPECIAL:
      n.setJSType(getNativeType(UNKNOWN_TYPE));
      break;

    case Token.OBJECTLIT:
      if (n.getJSType() == null) {
        n.setJSType(typeRegistry.createAnonymousObjectType());
      }
      break;

    // NOTE(nicksantos): If we ever support Array tuples,
    // we will need to put ARRAYLIT here as well.
  }
}
 
Example 6
Source File: Closure_95_TypedScopeCreator_t.java    From coming with MIT License 4 votes vote down vote up
private void attachLiteralTypes(Node n) {
  switch (n.getType()) {
    case Token.NULL:
      n.setJSType(getNativeType(NULL_TYPE));
      break;

    case Token.VOID:
      n.setJSType(getNativeType(VOID_TYPE));
      break;

    case Token.STRING:
      n.setJSType(getNativeType(STRING_TYPE));
      break;

    case Token.NUMBER:
      n.setJSType(getNativeType(NUMBER_TYPE));
      break;

    case Token.TRUE:
    case Token.FALSE:
      n.setJSType(getNativeType(BOOLEAN_TYPE));
      break;

    case Token.REGEXP:
      n.setJSType(getNativeType(REGEXP_TYPE));
      break;

    case Token.REF_SPECIAL:
      n.setJSType(getNativeType(UNKNOWN_TYPE));
      break;

    case Token.OBJECTLIT:
      if (n.getJSType() == null) {
        n.setJSType(typeRegistry.createAnonymousObjectType());
      }
      break;

    // NOTE(nicksantos): If we ever support Array tuples,
    // we will need to put ARRAYLIT here as well.
  }
}