optimize MemberFilter: don't visit JSReferenceExpression twice, don't call multiResolve twice

support JSDefinitionExpression correctly — we don't need to resolve it
This commit is contained in:
Vladimir Krivosheev
2015-02-02 09:00:19 +01:00
parent 827b297c36
commit ba75c66809
4 changed files with 23 additions and 10 deletions
@@ -47,12 +47,17 @@ public abstract class JavaScriptDebugAware {
protected abstract ExpressionInfo getEvaluationInfo(@NotNull PsiElement elementAtOffset, @NotNull Document document, @NotNull ExpressionInfoFactory expressionInfoFactory);
public static boolean isBreakpointAware(@NotNull FileType fileType) {
return getBreakpointAware(fileType) != null;
}
@Nullable
public static JavaScriptDebugAware getBreakpointAware(@NotNull FileType fileType) {
for (JavaScriptDebugAware debugAware : EP_NAME.getExtensions()) {
if (debugAware.getBreakpointTypeClass() == null && fileType.equals(debugAware.getFileType())) {
return true;
return debugAware;
}
}
return false;
return null;
}
@Nullable
@@ -9,7 +9,7 @@ import java.util.Collections;
public abstract class MemberFilterBase implements MemberFilter {
@Override
public boolean isMemberVisible(@NotNull Variable variable, boolean filterFunctions) {
return true;
return variable.isReadable();
}
@NotNull
@@ -38,4 +38,9 @@ public class SourceInfo extends XSourcePositionWrapper {
public Navigatable createNavigatable(@NotNull Project project) {
return new OpenFileDescriptor(project, myPosition.getFile(), myPosition.getLine(), column);
}
@Override
public String toString() {
return myPosition.getFile() + ":" + myPosition.getLine() + (column == -1 ? "": (":" + getColumn()));
}
}
@@ -19,8 +19,8 @@ import com.intellij.xdebugger.frame.presentation.XStringValuePresentation;
import com.intellij.xdebugger.frame.presentation.XValuePresentation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.concurrency.AsyncFunction;
import org.jetbrains.concurrency.ConsumerRunnable;
import org.jetbrains.concurrency.ObsolescentAsyncFunction;
import org.jetbrains.concurrency.Promise;
import org.jetbrains.debugger.values.*;
@@ -322,7 +322,12 @@ public final class VariableView extends XNamedValue implements VariableContext {
promises.add(computeNamedProperties(objectValue, node, !hasIndexedProperties && additionalProperties == null));
}
else {
promises.add(additionalProperties.then(new AsyncFunction<Void, Void>() {
promises.add(additionalProperties.then(new ObsolescentAsyncFunction<Void, Void>() {
@Override
public boolean isObsolete() {
return node.isObsolete();
}
@NotNull
@Override
public Promise<Void> fun(Void o) {
@@ -333,12 +338,10 @@ public final class VariableView extends XNamedValue implements VariableContext {
}
if (hasIndexedProperties == hasNamedProperties || additionalProperties != null) {
Promise.all(promises).processed(new ConsumerRunnable() {
Promise.all(promises).processed(new ObsolescentConsumer<Void>(node) {
@Override
public void run() {
if (!node.isObsolete()) {
node.addChildren(XValueChildrenList.EMPTY, true);
}
public void consume(Void aVoid) {
node.addChildren(XValueChildrenList.EMPTY, true);
}
});
}