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

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

Issue 1778363003: Improve search for constructors and import 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
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/dart/element/type.dart'; 9 import 'package:analyzer/dart/element/type.dart';
10 import 'package:analyzer/src/dart/element/member.dart'; 10 import 'package:analyzer/src/dart/element/member.dart';
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 if (node.constructorName != null) { 567 if (node.constructorName != null) {
568 int offset = node.period.offset; 568 int offset = node.period.offset;
569 int length = node.constructorName.end - offset; 569 int length = node.constructorName.end - offset;
570 recordRelationOffset( 570 recordRelationOffset(
571 element, IndexRelationKind.IS_REFERENCED_BY, offset, length, true); 571 element, IndexRelationKind.IS_REFERENCED_BY, offset, length, true);
572 } else { 572 } else {
573 int offset = node.superKeyword.end; 573 int offset = node.superKeyword.end;
574 recordRelationOffset( 574 recordRelationOffset(
575 element, IndexRelationKind.IS_REFERENCED_BY, offset, 0, true); 575 element, IndexRelationKind.IS_REFERENCED_BY, offset, 0, true);
576 } 576 }
577 super.visitSuperConstructorInvocation(node); 577 node.argumentList?.accept(this);
578 } 578 }
579 579
580 @override 580 @override
581 visitTypeName(TypeName node) { 581 visitTypeName(TypeName node) {
582 AstNode parent = node.parent; 582 AstNode parent = node.parent;
583 if (parent is ClassTypeAlias && parent.superclass == node) { 583 if (parent is ClassTypeAlias && parent.superclass == node) {
584 recordSuperType(node, IndexRelationKind.IS_EXTENDED_BY); 584 recordSuperType(node, IndexRelationKind.IS_EXTENDED_BY);
585 } else { 585 } else {
586 super.visitTypeName(node); 586 super.visitTypeName(node);
587 } 587 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 usedNames: nameRelations.map((r) => r.nameInfo.id).toList(), 756 usedNames: nameRelations.map((r) => r.nameInfo.id).toList(),
757 usedNameKinds: nameRelations.map((r) => r.kind).toList(), 757 usedNameKinds: nameRelations.map((r) => r.kind).toList(),
758 usedNameOffsets: nameRelations.map((r) => r.offset).toList()); 758 usedNameOffsets: nameRelations.map((r) => r.offset).toList());
759 } 759 }
760 760
761 void defineName(String name, IndexNameKind kind, int offset) { 761 void defineName(String name, IndexNameKind kind, int offset) {
762 _StringInfo nameInfo = pkg._getStringInfo(name); 762 _StringInfo nameInfo = pkg._getStringInfo(name);
763 definedNames.add(new _DefinedNameInfo(nameInfo, kind, offset)); 763 definedNames.add(new _DefinedNameInfo(nameInfo, kind, offset));
764 } 764 }
765 } 765 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698