Checks reordered for better performance

This commit is contained in:
Andrey Breslav
2011-09-06 11:56:20 +04:00
parent 93a422ae0a
commit f5928be33e
2 changed files with 8 additions and 9 deletions
@@ -3,7 +3,6 @@ package org.jetbrains.jet.plugin.structureView;
import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.ide.util.treeView.smartTree.TreeElement;
import com.intellij.navigation.ItemPresentation;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.util.Iconable;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.NavigatablePsiElement;
@@ -70,10 +69,10 @@ public class JetStructureViewElement implements StructureViewTreeElement {
: null;
}
@Override
public TextAttributesKey getTextAttributesKey() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
// @Override
// public TextAttributesKey getTextAttributesKey() {
// return null; //To change body of implemented methods use File | Settings | File Templates.
// }
};
}
+4 -4
View File
@@ -81,20 +81,20 @@ public abstract class TypeInfo<T> implements JetObject {
}
public final boolean isInstance(Object obj) {
if (obj == null) return nullable;
if (obj instanceof JetObject) {
return ((JetObject) obj).getTypeInfo().isSubtypeOf(this);
}
if (obj == null)
return nullable;
return theClass.isAssignableFrom(obj.getClass()); // TODO
}
public final boolean isSubtypeOf(TypeInfo<?> superType) {
if (!superType.theClass.isAssignableFrom(theClass)) {
if (nullable && !superType.nullable) {
return false;
}
if (nullable && !superType.nullable) {
if (!superType.theClass.isAssignableFrom(theClass)) {
return false;
}
if (projections != null) {