com.google.javascript.rhino.jstype.EnumElementType Java Examples

The following examples show how to use com.google.javascript.rhino.jstype.EnumElementType. 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: ChainableReverseAbstractInterpreter.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  // NOTE(nicksantos): This is a white lie. Suppose we have:
  // /** @enum {string|number} */ var MyEnum = ...;
  // if (goog.isNumber(myEnumInstance)) {
  //   /* what is myEnumInstance here? */
  // }
  // There is no type that represents {MyEnum - string}. What we really
  // need is a notion of "enum subtyping", so that we could dynamically
  // create a subtype of MyEnum restricted by string. In any case,
  // this should catch the common case.
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null &&
      enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #2
Source File: Cardumen_0024_t.java    From coming with MIT License 6 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  // NOTE(nicksantos): This is a white lie. Suppose we have:
  // /** @enum {string|number} */ var MyEnum = ...;
  // if (goog.isNumber(myEnumInstance)) {
  //   /* what is myEnumInstance here? */
  // }
  // There is no type that represents {MyEnum - string}. What we really
  // need is a notion of "enum subtyping", so that we could dynamically
  // create a subtype of MyEnum restricted by string. In any case,
  // this should catch the common case.
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null &&
      enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #3
Source File: Closure_19_ChainableReverseAbstractInterpreter_s.java    From coming with MIT License 6 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  // NOTE(nicksantos): This is a white lie. Suppose we have:
  // /** @enum {string|number} */ var MyEnum = ...;
  // if (goog.isNumber(myEnumInstance)) {
  //   /* what is myEnumInstance here? */
  // }
  // There is no type that represents {MyEnum - string}. What we really
  // need is a notion of "enum subtyping", so that we could dynamically
  // create a subtype of MyEnum restricted by string. In any case,
  // this should catch the common case.
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null && enumElementType.getPrimitiveType().equals(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #4
Source File: Cardumen_0024_s.java    From coming with MIT License 6 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  // NOTE(nicksantos): This is a white lie. Suppose we have:
  // /** @enum {string|number} */ var MyEnum = ...;
  // if (goog.isNumber(myEnumInstance)) {
  //   /* what is myEnumInstance here? */
  // }
  // There is no type that represents {MyEnum - string}. What we really
  // need is a notion of "enum subtyping", so that we could dynamically
  // create a subtype of MyEnum restricted by string. In any case,
  // this should catch the common case.
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null &&
      enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #5
Source File: Closure_19_ChainableReverseAbstractInterpreter_t.java    From coming with MIT License 6 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  // NOTE(nicksantos): This is a white lie. Suppose we have:
  // /** @enum {string|number} */ var MyEnum = ...;
  // if (goog.isNumber(myEnumInstance)) {
  //   /* what is myEnumInstance here? */
  // }
  // There is no type that represents {MyEnum - string}. What we really
  // need is a notion of "enum subtyping", so that we could dynamically
  // create a subtype of MyEnum restricted by string. In any case,
  // this should catch the common case.
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null && enumElementType.getPrimitiveType().equals(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #6
Source File: Closure_7_ChainableReverseAbstractInterpreter_t.java    From coming with MIT License 6 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  // NOTE(nicksantos): This is a white lie. Suppose we have:
  // /** @enum {string|number} */ var MyEnum = ...;
  // if (goog.isNumber(myEnumInstance)) {
  //   /* what is myEnumInstance here? */
  // }
  // There is no type that represents {MyEnum - string}. What we really
  // need is a notion of "enum subtyping", so that we could dynamically
  // create a subtype of MyEnum restricted by string. In any case,
  // this should catch the common case.
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null &&
      enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #7
Source File: Closure_7_ChainableReverseAbstractInterpreter_s.java    From coming with MIT License 6 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  // NOTE(nicksantos): This is a white lie. Suppose we have:
  // /** @enum {string|number} */ var MyEnum = ...;
  // if (goog.isNumber(myEnumInstance)) {
  //   /* what is myEnumInstance here? */
  // }
  // There is no type that represents {MyEnum - string}. What we really
  // need is a notion of "enum subtyping", so that we could dynamically
  // create a subtype of MyEnum restricted by string. In any case,
  // this should catch the common case.
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null &&
      enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #8
Source File: Closure_7_ChainableReverseAbstractInterpreter_s.java    From coming with MIT License 5 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null &&
      enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #9
Source File: TypeExpressionParser.java    From js-dossier with Apache License 2.0 5 votes vote down vote up
@Override
public Void caseEnumElementType(EnumElementType type) {
  List<NominalType> types = typeRegistry.getTypes(type.getEnumType());
  if (types.isEmpty()) {
    type.getEnumType().visit(this);
  } else {
    com.github.jsdossier.proto.NamedType link = linkFactory.createTypeReference(types.get(0));
    currentExpression().setNamedType(link);
  }
  return null;
}
 
Example #10
Source File: ChainableReverseAbstractInterpreter.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null &&
      enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #11
Source File: ChainableReverseAbstractInterpreter.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null && enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #12
Source File: Closure_19_ChainableReverseAbstractInterpreter_s.java    From coming with MIT License 5 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null && enumElementType.getPrimitiveType().equals(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #13
Source File: Closure_19_ChainableReverseAbstractInterpreter_s.java    From coming with MIT License 5 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null && enumElementType.getPrimitiveType().equals(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #14
Source File: Closure_19_ChainableReverseAbstractInterpreter_t.java    From coming with MIT License 5 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null && enumElementType.getPrimitiveType().equals(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #15
Source File: Closure_19_ChainableReverseAbstractInterpreter_t.java    From coming with MIT License 5 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null && enumElementType.getPrimitiveType().equals(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #16
Source File: Closure_7_ChainableReverseAbstractInterpreter_s.java    From coming with MIT License 5 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null && enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #17
Source File: Closure_7_ChainableReverseAbstractInterpreter_t.java    From coming with MIT License 5 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null &&
      enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #18
Source File: Closure_7_ChainableReverseAbstractInterpreter_t.java    From coming with MIT License 5 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null && enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #19
Source File: Cardumen_0024_s.java    From coming with MIT License 5 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null &&
      enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #20
Source File: Cardumen_0024_s.java    From coming with MIT License 5 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null && enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #21
Source File: Cardumen_0024_t.java    From coming with MIT License 5 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null &&
      enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #22
Source File: Cardumen_0024_t.java    From coming with MIT License 5 votes vote down vote up
@Override
public JSType caseEnumElementType(EnumElementType enumElementType) {
  JSType type = enumElementType.getPrimitiveType().visit(this);
  if (type != null && enumElementType.getPrimitiveType().isEquivalentTo(type)) {
    return enumElementType;
  } else {
    return type;
  }
}
 
Example #23
Source File: AbstractNoOpVisitor.java    From jsinterop-generator with Apache License 2.0 4 votes vote down vote up
@Override
public T caseEnumElementType(EnumElementType type) {
  return null;
}
 
Example #24
Source File: DeclarationGenerator.java    From clutz with MIT License 4 votes vote down vote up
@Override
public Void caseEnumElementType(EnumElementType type) {
  return null;
}
 
Example #25
Source File: TypeCollectionPass.java    From js-dossier with Apache License 2.0 4 votes vote down vote up
@Override
public Object caseEnumElementType(EnumElementType type) {
  return null;
}
 
Example #26
Source File: ClosureTypeRegistry.java    From jsinterop-generator with Apache License 2.0 4 votes vote down vote up
@Override
public TypeReference caseEnumElementType(EnumElementType type) {
  return new JavaTypeReference(checkNotNull(getJavaType(type)));
}