コード例 #1
0
 /** Create a new constructor with the parameters and return type stripped. */
 public FunctionType cloneWithoutArrowType() {
   FunctionType result =
       new FunctionType(
           registry,
           getReferenceName(),
           source,
           registry.createArrowType(null, null),
           getInstanceType(),
           null,
           true,
           false);
   result.setPrototypeBasedOn(getInstanceType());
   return result;
 }
コード例 #2
0
 @Override
 boolean defineProperty(String name, JSType type, boolean inferred, Node propertyNode) {
   if ("prototype".equals(name)) {
     ObjectType objType = type.toObjectType();
     if (objType != null) {
       if (prototypeSlot != null && objType.isEquivalentTo(prototypeSlot.getType())) {
         return true;
       }
       setPrototypeBasedOn(objType, propertyNode);
       return true;
     } else {
       return false;
     }
   }
   return super.defineProperty(name, type, inferred, propertyNode);
 }
コード例 #3
0
 /**
  * Sets the prototype, creating the prototype object from the given base type.
  *
  * @param baseType The base type.
  */
 public void setPrototypeBasedOn(ObjectType baseType) {
   setPrototypeBasedOn(baseType, null);
 }
コード例 #4
0
 private void maybeSetBaseType(FunctionType fnType) {
   if (baseType != null) {
     fnType.setPrototypeBasedOn(baseType);
   }
 }