Java Code Examples for com.google.javascript.rhino.jstype.FunctionType#getAllImplementedInterfaces()

The following examples show how to use com.google.javascript.rhino.jstype.FunctionType#getAllImplementedInterfaces() . 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: TypeRegistry.java    From js-dossier with Apache License 2.0 6 votes vote down vote up
private void scanImplementedInterfaces(FunctionType ctor) {
  checkArgument(ctor.isConstructor());

  Set<FunctionType> seen = new HashSet<>();
  for (ObjectType iface : ctor.getAllImplementedInterfaces()) {
    if (iface.isUnknownType()
        || iface.getConstructor() == null
        || !iface.getConstructor().isInterface()) {
      continue;
    }

    implementedInterfaces.put(ctor, iface);
    knownImplementations.put(iface.getConstructor(), ctor.getInstanceType());

    scanExtendedInterfaces(seen, iface.getConstructor());

    for (ObjectType superInterface : implementedInterfaces.get(iface.getConstructor())) {
      implementedInterfaces.put(ctor, superInterface);
      knownImplementations.put(superInterface.getConstructor(), ctor.getInstanceType());
    }
  }
}
 
Example 2
Source File: Closure_117_TypeValidator_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Expect that all properties on interfaces that this type implements are
 * implemented and correctly typed.
 */
void expectAllInterfaceProperties(NodeTraversal t, Node n,
    FunctionType type) {
  ObjectType instance = type.getInstanceType();
  for (ObjectType implemented : type.getAllImplementedInterfaces()) {
    if (implemented.getImplicitPrototype() != null) {
      for (String prop :
           implemented.getImplicitPrototype().getOwnPropertyNames()) {
        expectInterfaceProperty(t, n, instance, implemented, prop);
      }
    }
  }
}
 
Example 3
Source File: Closure_117_TypeValidator_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Expect that all properties on interfaces that this type implements are
 * implemented and correctly typed.
 */
void expectAllInterfaceProperties(NodeTraversal t, Node n,
    FunctionType type) {
  ObjectType instance = type.getInstanceType();
  for (ObjectType implemented : type.getAllImplementedInterfaces()) {
    if (implemented.getImplicitPrototype() != null) {
      for (String prop :
           implemented.getImplicitPrototype().getOwnPropertyNames()) {
        expectInterfaceProperty(t, n, instance, implemented, prop);
      }
    }
  }
}
 
Example 4
Source File: Closure_6_TypeValidator_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Expect that all properties on interfaces that this type implements are
 * implemented and correctly typed.
 */
void expectAllInterfaceProperties(NodeTraversal t, Node n,
    FunctionType type) {
  ObjectType instance = type.getInstanceType();
  for (ObjectType implemented : type.getAllImplementedInterfaces()) {
    if (implemented.getImplicitPrototype() != null) {
      for (String prop :
           implemented.getImplicitPrototype().getOwnPropertyNames()) {
        expectInterfaceProperty(t, n, instance, implemented, prop);
      }
    }
  }
}
 
Example 5
Source File: Closure_6_TypeValidator_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Expect that all properties on interfaces that this type implements are
 * implemented and correctly typed.
 */
void expectAllInterfaceProperties(NodeTraversal t, Node n,
    FunctionType type) {
  ObjectType instance = type.getInstanceType();
  for (ObjectType implemented : type.getAllImplementedInterfaces()) {
    if (implemented.getImplicitPrototype() != null) {
      for (String prop :
           implemented.getImplicitPrototype().getOwnPropertyNames()) {
        expectInterfaceProperty(t, n, instance, implemented, prop);
      }
    }
  }
}
 
Example 6
Source File: TypeValidator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Expect that all properties on interfaces that this type implements are
 * implemented and correctly typed.
 */
void expectAllInterfaceProperties(NodeTraversal t, Node n,
    FunctionType type) {
  ObjectType instance = type.getInstanceType();
  for (ObjectType implemented : type.getAllImplementedInterfaces()) {
    if (implemented.getImplicitPrototype() != null) {
      for (String prop :
           implemented.getImplicitPrototype().getOwnPropertyNames()) {
        expectInterfaceProperty(t, n, instance, implemented, prop);
      }
    }
  }
}