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

Unified Diff: pkg/analysis_server/lib/src/services/index/index_contributor.dart

Issue 949623005: Field references in field format parameter declarations and initializers mean writing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 months 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/search/search_engine_internal.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/index/index_contributor.dart
diff --git a/pkg/analysis_server/lib/src/services/index/index_contributor.dart b/pkg/analysis_server/lib/src/services/index/index_contributor.dart
index c8748faed4f9ee325fadd667700b1485c95d3c1b..53c078893aedf7bea34dabf17fa453ae601fd40f 100644
--- a/pkg/analysis_server/lib/src/services/index/index_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/index/index_contributor.dart
@@ -229,6 +229,22 @@ class _IndexContributor extends GeneralizingAstVisitor<Object> {
}
@override
+ visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
+ SimpleIdentifier fieldName = node.fieldName;
+ Expression expression = node.expression;
+ // field reference is write here
+ if (fieldName != null) {
+ Element element = fieldName.staticElement;
+ Location location = _createLocationForNode(fieldName);
+ _store.recordRelationship(element, IndexConstants.IS_WRITTEN_BY, location);
+ }
+ // index expression
+ if (expression != null) {
+ expression.accept(this);
+ }
+ }
+
+ @override
Object visitConstructorName(ConstructorName node) {
ConstructorElement element = node.staticElement;
// in 'class B = A;' actually A constructors are invoked
@@ -457,7 +473,11 @@ class _IndexContributor extends GeneralizingAstVisitor<Object> {
}
// this.field parameter
if (element is FieldFormalParameterElement) {
- element = (element as FieldFormalParameterElement).field;
+ Relationship relationship = peekElement() == element ?
+ IndexConstants.IS_WRITTEN_BY :
+ IndexConstants.IS_REFERENCED_BY;
+ _store.recordRelationship(element.field, relationship, location);
+ return null;
}
// record specific relations
if (element is ClassElement ||
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/search/search_engine_internal.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698