private JSType applyCommonRestriction(JSType type) { if (target.isUnknownType()) { return type; } FunctionType funcTarget = target.toMaybeFunctionType(); if (funcTarget.hasInstanceType()) { return type.getGreatestSubtype(funcTarget.getInstanceType()); } return null; } }
private JSType applyCommonRestriction(JSType type) { if (target.isUnknownType()) { return type; } FunctionType funcTarget = target.toMaybeFunctionType(); if (funcTarget.hasInstanceType()) { return type.getGreatestSubtype(funcTarget.getInstanceType()); } return null; } }
@Override public JSType caseUnionType(UnionType type) { if (target.isUnknownType()) { return type; } FunctionType funcTarget = target.toMaybeFunctionType(); if (funcTarget.hasInstanceType()) { return type.getRestrictedUnion(funcTarget.getInstanceType()); } return null; }
@Override public JSType caseUnionType(UnionType type) { if (target.isUnknownType()) { return type; } FunctionType funcTarget = target.toMaybeFunctionType(); if (funcTarget.hasInstanceType()) { return type.getRestrictedUnion(funcTarget.getInstanceType()); } return null; }
@Override public JSType caseObjectType(ObjectType type) { if (target.isUnknownType()) { return type; } FunctionType funcTarget = target.toMaybeFunctionType(); if (funcTarget.hasInstanceType()) { if (type.isSubtypeOf(funcTarget.getInstanceType())) { return null; } return type; } return null; }
@Override public JSType caseObjectType(ObjectType type) { if (target.isUnknownType()) { return type; } FunctionType funcTarget = target.toMaybeFunctionType(); if (funcTarget.hasInstanceType()) { if (type.isSubtype(funcTarget.getInstanceType())) { return null; } return type; } return null; }
private FunctionType getConstructor(JSType type) { ObjectType objType = type.toMaybeObjectType(); if (objType == null) { return null; } FunctionType constructor = null; if (objType.isFunctionType()) { constructor = objType.toMaybeFunctionType(); } else if (objType.isFunctionPrototypeType()) { constructor = objType.getOwnerFunction(); } else { constructor = objType.getConstructor(); } return constructor; } }
private FunctionType getConstructor(JSType type) { ObjectType objType = ObjectType.cast(type); if (objType == null) { return null; } FunctionType constructor = null; if (objType.isFunctionType()) { constructor = objType.toMaybeFunctionType(); } else if (objType.isFunctionPrototypeType()) { constructor = objType.getOwnerFunction(); } else { constructor = objType.getConstructor(); } return constructor != null && constructor.isConstructor() ? constructor : null; } }
/** Invalidates the given type, so that no properties on it will be inlined or renamed. */ private Builder addType(JSType type, TypeMismatch mismatch) { type = type.restrictByNotNullOrUndefined(); if (type.isUnionType()) { for (JSType alt : type.getUnionMembers()) { addType(alt, mismatch); } } else if (type.isEnumElementType()) { // only in disamb addType(type.getEnumeratedTypeOfEnumElement(), mismatch); } else { // amb and inl both do this without the else checkState(!type.isUnionType()); types.add(type); recordInvalidation(type, mismatch); ObjectType objType = type.toMaybeObjectType(); if (objType != null) { ObjectType proto = objType.getImplicitPrototype(); if (proto != null) { types.add(proto); recordInvalidation(proto, mismatch); } if (objType.isConstructor()) { types.add(objType.toMaybeFunctionType().getInstanceType()); } else if (objType.isInstanceType()) { types.add(objType.getConstructor()); } } } return this; }
if (isEs6ClassConstructor(proto)) { parentSymbol = getSymbolDeclaredBy(proto.toMaybeFunctionType()); } else if (proto.getConstructor() != null) {
&& !objectType.toMaybeFunctionType().isConstructor())) { return;
&& !objectType.toMaybeFunctionType().isConstructor())) { return;
/** * Invalidates the given type, so that no properties on it will be renamed. */ private void recordInvalidatingType(JSType type, JSError error) { type = type.restrictByNotNullOrUndefined(); if (type.isUnionType()) { for (JSType alt : type.toMaybeUnionType().getAlternatesWithoutStructuralTyping()) { recordInvalidatingType(alt, error); } } else if (type.isEnumElementType()) { recordInvalidatingType( type.toMaybeEnumElementType().getPrimitiveType(), error); } else { addInvalidatingType(type); recordInvalidationError(type, error); ObjectType objType = ObjectType.cast(type); if (objType != null && objType.getImplicitPrototype() != null) { addInvalidatingType(objType.getImplicitPrototype()); recordInvalidationError(objType.getImplicitPrototype(), error); } if (objType != null && objType.isConstructor() && objType.isFunctionType()) { addInvalidatingType(objType.toMaybeFunctionType().getInstanceType()); } } }
String property = NodeUtil.getObjectLitKeyName(key); if (owner.isClass()) { checkPropertyInheritanceOnClassMember(t, key, property, type.toMaybeFunctionType()); } else { checkPropertyInheritanceOnPrototypeLitKey(t, key, property, type);