Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2016)

Unified Diff: dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/index/MemoryIndexStoreImpl.java

Issue 64033002: Version 0.8.10.8 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/index/MemoryIndexStoreImpl.java
===================================================================
--- dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/index/MemoryIndexStoreImpl.java (revision 30037)
+++ dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/index/MemoryIndexStoreImpl.java (working copy)
@@ -213,6 +213,10 @@
return;
}
location = location.clone();
+ // at the index level we don't care about Member(s)
+ if (element instanceof Member) {
+ element = ((Member) element).getBaseElement();
+ }
// prepare information
AnalysisContext elementContext = element.getContext();
AnalysisContext locationContext = location.getElement().getContext();
@@ -222,10 +226,17 @@
if (locationContext == null) {
return;
}
+ if (locationSource == null) {
+ return;
+ }
if (elementContext == null && !(element instanceof NameElementImpl)
&& !(element instanceof UniverseElementImpl)) {
return;
}
+ if (elementSource == null && !(element instanceof NameElementImpl)
+ && !(element instanceof UniverseElementImpl)) {
+ return;
+ }
// may be already removed in other thread
if (removedContexts.containsKey(elementContext)) {
return;
@@ -233,10 +244,6 @@
if (removedContexts.containsKey(locationContext)) {
return;
}
- // at the index level we don't care about Member(s)
- if (element instanceof Member) {
- element = ((Member) element).getBaseElement();
- }
// record: key -> location(s)
ElementRelationKey key = getCanonicalKey(element, relationship);
{
@@ -288,6 +295,10 @@
@Override
public void removeContext(AnalysisContext context) {
context = unwrapContext(context);
+ if (context == null) {
+ return;
+ }
+ // mark as removed
removedContexts.put(context, WEAK_SET_VALUE);
removeSources(context, null);
// remove context
@@ -298,6 +309,9 @@
@Override
public void removeSource(AnalysisContext context, Source source) {
context = unwrapContext(context);
+ if (context == null) {
+ return;
+ }
// remove locations defined in source
clearSource(context, source);
// remove keys for elements defined in source
@@ -321,6 +335,9 @@
@Override
public void removeSources(AnalysisContext context, SourceContainer container) {
context = unwrapContext(context);
+ if (context == null) {
+ return;
+ }
// remove sources #1
Map<Source, Set<ElementRelationKey>> sourceToKeys = contextToSourceToKeys.get(context);
if (sourceToKeys != null) {

Powered by Google App Engine
This is Rietveld 408576698