Search in sources :

Example 1 with JSSpecialNamedTypeImpl

use of com.intellij.lang.javascript.psi.types.JSSpecialNamedTypeImpl in project intellij-plugins by JetBrains.

the class ActionScriptTypeHelper method isAssignableToNamedType.

@Override
public boolean isAssignableToNamedType(@NotNull JSTypeImpl lOpType, @NotNull JSType rOpType, @Nullable ProcessingContext processingContext) {
    //noinspection unchecked
    Map<Key, Object> cachesMap = processingContext != null ? (Map<Key, Object>) processingContext.get(this) : null;
    PsiElement type = ourResolvedTypeKey.get(cachesMap);
    JSClass clazz = null;
    if (type == null) {
        type = lOpType.resolveClass();
        ourResolvedTypeKey.set(cachesMap, type != null ? type : PsiUtilCore.NULL_PSI_ELEMENT);
    } else if (type == PsiUtilCore.NULL_PSI_ELEMENT) {
        type = null;
    }
    if (type instanceof JSClass)
        clazz = (JSClass) type;
    JSClass jsClass = rOpType.resolveClass();
    if (jsClass == null && rOpType instanceof JSTypeImpl || rOpType instanceof JSSpecialNamedTypeImpl) {
        return areNamedTypesAssignable(lOpType, (JSNamedType) rOpType, processingContext);
    }
    if (jsClass != null && clazz != null) {
        return JSInheritanceUtil.isParentClass(jsClass, clazz, false, jsClass);
    }
    if (clazz == null) {
        return false;
    }
    return true;
}
Also used : JSTypeImpl(com.intellij.lang.javascript.psi.types.JSTypeImpl) JSSpecialNamedTypeImpl(com.intellij.lang.javascript.psi.types.JSSpecialNamedTypeImpl) JSClass(com.intellij.lang.javascript.psi.ecmal4.JSClass) Key(com.intellij.openapi.util.Key) PsiElement(com.intellij.psi.PsiElement)

Aggregations

JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)1 JSSpecialNamedTypeImpl (com.intellij.lang.javascript.psi.types.JSSpecialNamedTypeImpl)1 JSTypeImpl (com.intellij.lang.javascript.psi.types.JSTypeImpl)1 Key (com.intellij.openapi.util.Key)1 PsiElement (com.intellij.psi.PsiElement)1