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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library services.src.index.index_contributor; 5 library services.src.index.index_contributor;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 8
9 import 'package:analysis_server/src/services/correction/namespace.dart'; 9 import 'package:analysis_server/src/services/correction/namespace.dart';
10 import 'package:analysis_server/src/services/index/index.dart'; 10 import 'package:analysis_server/src/services/index/index.dart';
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 ConstructorElement element = node.element; 222 ConstructorElement element = node.element;
223 enterScope(element); 223 enterScope(element);
224 try { 224 try {
225 return super.visitConstructorDeclaration(node); 225 return super.visitConstructorDeclaration(node);
226 } finally { 226 } finally {
227 _exitScope(); 227 _exitScope();
228 } 228 }
229 } 229 }
230 230
231 @override 231 @override
232 visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
233 SimpleIdentifier fieldName = node.fieldName;
234 Expression expression = node.expression;
235 // field reference is write here
236 if (fieldName != null) {
237 Element element = fieldName.staticElement;
238 Location location = _createLocationForNode(fieldName);
239 _store.recordRelationship(element, IndexConstants.IS_WRITTEN_BY, location) ;
240 }
241 // index expression
242 if (expression != null) {
243 expression.accept(this);
244 }
245 }
246
247 @override
232 Object visitConstructorName(ConstructorName node) { 248 Object visitConstructorName(ConstructorName node) {
233 ConstructorElement element = node.staticElement; 249 ConstructorElement element = node.staticElement;
234 // in 'class B = A;' actually A constructors are invoked 250 // in 'class B = A;' actually A constructors are invoked
235 if (element != null && 251 if (element != null &&
236 element.isSynthetic && 252 element.isSynthetic &&
237 element.redirectedConstructor != null) { 253 element.redirectedConstructor != null) {
238 element = element.redirectedConstructor; 254 element = element.redirectedConstructor;
239 } 255 }
240 // prepare location 256 // prepare location
241 Location location; 257 Location location;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 location); 466 location);
451 } else if (inSetterContext) { 467 } else if (inSetterContext) {
452 _store.recordRelationship( 468 _store.recordRelationship(
453 nameElement, 469 nameElement,
454 IndexConstants.IS_WRITTEN_BY, 470 IndexConstants.IS_WRITTEN_BY,
455 location); 471 location);
456 } 472 }
457 } 473 }
458 // this.field parameter 474 // this.field parameter
459 if (element is FieldFormalParameterElement) { 475 if (element is FieldFormalParameterElement) {
460 element = (element as FieldFormalParameterElement).field; 476 Relationship relationship = peekElement() == element ?
477 IndexConstants.IS_WRITTEN_BY :
478 IndexConstants.IS_REFERENCED_BY;
479 _store.recordRelationship(element.field, relationship, location);
480 return null;
461 } 481 }
462 // record specific relations 482 // record specific relations
463 if (element is ClassElement || 483 if (element is ClassElement ||
464 element is FunctionElement || 484 element is FunctionElement ||
465 element is FunctionTypeAliasElement || 485 element is FunctionTypeAliasElement ||
466 element is LabelElement || 486 element is LabelElement ||
467 element is MethodElement || 487 element is MethodElement ||
468 element is PropertyAccessorElement || 488 element is PropertyAccessorElement ||
469 element is PropertyInducingElement || 489 element is PropertyInducingElement ||
470 element is TypeParameterElement) { 490 element is TypeParameterElement) {
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 } 819 }
800 820
801 /** 821 /**
802 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node ". 822 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node ".
803 */ 823 */
804 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { 824 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) {
805 AstNode parent = node.parent; 825 AstNode parent = node.parent;
806 return parent is PrefixedIdentifier && parent.identifier == node; 826 return parent is PrefixedIdentifier && parent.identifier == node;
807 } 827 }
808 } 828 }
OLDNEW
« 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