/** * If a constructor statement is not emitted TS will assume a constructor with no arguments and * no body (default ctor) for base classes, or the constructor of the superclass. * * <p>Omitting the constructor is correct only if the closure class and *all* its superclasses * have zero argument constructors. If the supertype is NoResolvedType we cannot know whether * that's the case so we must return true. */ private boolean mustEmitConstructor(FunctionType type) { while (type != null) { if (type.getParameters().iterator().hasNext()) return true; ObjectType oType = getSuperType(type); if (oType == null) return false; if (oType.isNoResolvedType()) return true; type = oType.getConstructor(); } return false; }
/** * Gets the property type of the property whose name is given. If the * underlying object does not have this property, the Unknown type is * returned to indicate that no information is available on this property. * * This gets overridden by FunctionType for lazily-resolved call() and * bind() functions. * * @return the property's type or {@link UnknownType}. This method never * returns {@code null}. */ public JSType getPropertyType(String propertyName) { StaticTypedSlot slot = getSlot(propertyName); if (slot == null) { if (isNoResolvedType() || isCheckedUnknownType()) { return getNativeType(JSTypeNative.CHECKED_UNKNOWN_TYPE); } else if (isEmptyType()) { return getNativeType(JSTypeNative.NO_TYPE); } return getNativeType(JSTypeNative.UNKNOWN_TYPE); } return slot.getType(); }
/** * Gets the property type of the property whose name is given. If the * underlying object does not have this property, the Unknown type is * returned to indicate that no information is available on this property. * * This gets overridden by FunctionType for lazily-resolved call() and * bind() functions. * * @return the property's type or {@link UnknownType}. This method never * returns {@code null}. */ public JSType getPropertyType(String propertyName) { StaticTypedSlot<JSType> slot = getSlot(propertyName); if (slot == null) { if (isNoResolvedType() || isCheckedUnknownType()) { return getNativeType(JSTypeNative.CHECKED_UNKNOWN_TYPE); } else if (isEmptyType()) { return getNativeType(JSTypeNative.NO_TYPE); } return getNativeType(JSTypeNative.UNKNOWN_TYPE); } return slot.getType(); }