Checks reordered for better performance
This commit is contained in:
@@ -3,7 +3,6 @@ package org.jetbrains.jet.plugin.structureView;
|
|||||||
import com.intellij.ide.structureView.StructureViewTreeElement;
|
import com.intellij.ide.structureView.StructureViewTreeElement;
|
||||||
import com.intellij.ide.util.treeView.smartTree.TreeElement;
|
import com.intellij.ide.util.treeView.smartTree.TreeElement;
|
||||||
import com.intellij.navigation.ItemPresentation;
|
import com.intellij.navigation.ItemPresentation;
|
||||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
|
||||||
import com.intellij.openapi.util.Iconable;
|
import com.intellij.openapi.util.Iconable;
|
||||||
import com.intellij.openapi.util.text.StringUtil;
|
import com.intellij.openapi.util.text.StringUtil;
|
||||||
import com.intellij.psi.NavigatablePsiElement;
|
import com.intellij.psi.NavigatablePsiElement;
|
||||||
@@ -70,10 +69,10 @@ public class JetStructureViewElement implements StructureViewTreeElement {
|
|||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public TextAttributesKey getTextAttributesKey() {
|
// public TextAttributesKey getTextAttributesKey() {
|
||||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
// return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,20 +81,20 @@ public abstract class TypeInfo<T> implements JetObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isInstance(Object obj) {
|
public final boolean isInstance(Object obj) {
|
||||||
|
if (obj == null) return nullable;
|
||||||
|
|
||||||
if (obj instanceof JetObject) {
|
if (obj instanceof JetObject) {
|
||||||
return ((JetObject) obj).getTypeInfo().isSubtypeOf(this);
|
return ((JetObject) obj).getTypeInfo().isSubtypeOf(this);
|
||||||
}
|
}
|
||||||
if (obj == null)
|
|
||||||
return nullable;
|
|
||||||
|
|
||||||
return theClass.isAssignableFrom(obj.getClass()); // TODO
|
return theClass.isAssignableFrom(obj.getClass()); // TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isSubtypeOf(TypeInfo<?> superType) {
|
public final boolean isSubtypeOf(TypeInfo<?> superType) {
|
||||||
if (!superType.theClass.isAssignableFrom(theClass)) {
|
if (nullable && !superType.nullable) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (nullable && !superType.nullable) {
|
if (!superType.theClass.isAssignableFrom(theClass)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (projections != null) {
|
if (projections != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user