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

Side by Side Diff: pkg/analyzer/lib/src/summary/index_unit.dart

Issue 1760243004: Implement search for local elements. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « pkg/analysis_server/test/services/search/search_engine2_test.dart ('k') | no next file » | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'package:analyzer/dart/ast/ast.dart'; 5 import 'package:analyzer/dart/ast/ast.dart';
6 import 'package:analyzer/dart/ast/token.dart'; 6 import 'package:analyzer/dart/ast/token.dart';
7 import 'package:analyzer/dart/ast/visitor.dart'; 7 import 'package:analyzer/dart/ast/visitor.dart';
8 import 'package:analyzer/dart/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/src/dart/element/member.dart'; 9 import 'package:analyzer/src/dart/element/member.dart';
10 import 'package:analyzer/src/generated/utilities_dart.dart'; 10 import 'package:analyzer/src/generated/utilities_dart.dart';
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 bool isQualified = _isQualified(node); 510 bool isQualified = _isQualified(node);
511 if (isQualified && element == null) { 511 if (isQualified && element == null) {
512 recordNameRelation(node, IndexRelationKind.IS_REFERENCED_BY); 512 recordNameRelation(node, IndexRelationKind.IS_REFERENCED_BY);
513 } 513 }
514 // this.field parameter 514 // this.field parameter
515 if (element is FieldFormalParameterElement) { 515 if (element is FieldFormalParameterElement) {
516 recordRelation( 516 recordRelation(
517 element.field, IndexRelationKind.IS_REFERENCED_BY, node, true); 517 element.field, IndexRelationKind.IS_REFERENCED_BY, node, true);
518 return; 518 return;
519 } 519 }
520 // ignore a local reference to a parameter
521 if (element is ParameterElement && node.parent is! Label) {
522 return;
523 }
520 // record specific relations 524 // record specific relations
521 recordRelation( 525 recordRelation(
522 element, IndexRelationKind.IS_REFERENCED_BY, node, isQualified); 526 element, IndexRelationKind.IS_REFERENCED_BY, node, isQualified);
523 } 527 }
524 528
525 @override 529 @override
526 visitSuperConstructorInvocation(SuperConstructorInvocation node) { 530 visitSuperConstructorInvocation(SuperConstructorInvocation node) {
527 ConstructorElement element = node.staticElement; 531 ConstructorElement element = node.staticElement;
528 if (node.constructorName != null) { 532 if (node.constructorName != null) {
529 int offset = node.period.offset; 533 int offset = node.period.offset;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 usedNames: nameRelations.map((r) => r.nameId).toList(), 671 usedNames: nameRelations.map((r) => r.nameId).toList(),
668 usedNameKinds: nameRelations.map((r) => r.kind).toList(), 672 usedNameKinds: nameRelations.map((r) => r.kind).toList(),
669 usedNameOffsets: nameRelations.map((r) => r.offset).toList()); 673 usedNameOffsets: nameRelations.map((r) => r.offset).toList());
670 } 674 }
671 675
672 void defineName(String name, IndexNameKind kind, int offset) { 676 void defineName(String name, IndexNameKind kind, int offset) {
673 int nameId = pkg._getStringId(name); 677 int nameId = pkg._getStringId(name);
674 definedNames.add(new _DefinedNameInfo(nameId, kind, offset)); 678 definedNames.add(new _DefinedNameInfo(nameId, kind, offset));
675 } 679 }
676 } 680 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/search/search_engine2_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698