コード例 #1
0
 public void setExtendedInterfaces(List<ObjectType> extendedInterfaces)
     throws UnsupportedOperationException {
   if (isInterface()) {
     this.extendedInterfaces = ImmutableList.copyOf(extendedInterfaces);
     for (ObjectType extendedInterface : this.extendedInterfaces) {
       typeOfThis.extendTemplateTypeMap(extendedInterface.getTemplateTypeMap());
     }
   } else {
     throw new UnsupportedOperationException();
   }
 }
コード例 #2
0
  TemplatizedType(
      JSTypeRegistry registry,
      ObjectType objectType,
      ImmutableList<JSType> templateTypes,
      ImmutableList<JSType> unresolvedTemplateTypes) {
    super(registry, objectType, objectType.getTemplateTypeMap().addValues(templateTypes));

    // Cache which template keys were filled, and what JSTypes they were filled
    // with.
    ImmutableList<TemplateType> filledTemplateKeys =
        objectType.getTemplateTypeMap().getUnfilledTemplateKeys();
    ImmutableList.Builder<JSType> builder = ImmutableList.builder();
    for (TemplateType filledTemplateKey : filledTemplateKeys) {
      builder.add(getTemplateTypeMap().getResolvedTemplateType(filledTemplateKey));
    }
    this.templateTypes = builder.build();
    this.unresolvedTemplateTypes = unresolvedTemplateTypes;

    replacer = new TemplateTypeMapReplacer(registry, getTemplateTypeMap());
  }
コード例 #3
0
 public void setImplementedInterfaces(List<ObjectType> implementedInterfaces) {
   if (isConstructor()) {
     // Records this type for each implemented interface.
     for (ObjectType type : implementedInterfaces) {
       registry.registerTypeImplementingInterface(this, type);
       typeOfThis.extendTemplateTypeMap(type.getTemplateTypeMap());
     }
     this.implementedInterfaces = ImmutableList.copyOf(implementedInterfaces);
   } else {
     throw new UnsupportedOperationException();
   }
 }
コード例 #4
0
 /**
  * Extends the TemplateTypeMap of the function's this type, based on the specified type.
  *
  * @param type
  */
 public void extendTemplateTypeMapBasedOn(ObjectType type) {
   typeOfThis.extendTemplateTypeMap(type.getTemplateTypeMap());
 }