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

Unified Diff: pkg/analysis_server/lib/src/computer/computer_navigation.dart

Issue 882823002: Issue 22143. Navigation from super initializers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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/test/analysis/notification_navigation_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/computer/computer_navigation.dart
diff --git a/pkg/analysis_server/lib/src/computer/computer_navigation.dart b/pkg/analysis_server/lib/src/computer/computer_navigation.dart
index ab0d8547f53b5cb462b1c4da2deb29dcb1c06b02..c3081ba43d7a7208fd3fd6aa2317812a1c2728ca 100644
--- a/pkg/analysis_server/lib/src/computer/computer_navigation.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_navigation.dart
@@ -33,6 +33,16 @@ class DartUnitNavigationComputer {
_unit.accept(new _DartUnitNavigationComputerVisitor(this));
}
+ int _addFile(String file) {
+ int index = fileMap[file];
+ if (index == null) {
+ index = files.length;
+ files.add(file);
+ fileMap[file] = index;
+ }
+ return index;
+ }
+
void _addRegion(int offset, int length, Element element) {
if (element is FieldFormalParameterElement) {
element = (element as FieldFormalParameterElement).field;
@@ -48,28 +58,6 @@ class DartUnitNavigationComputer {
new protocol.NavigationRegion(offset, length, <int>[targetIndex]));
}
- int _addTarget(Element element) {
- int index = targetMap[element];
- if (index == null) {
- index = targets.length;
- protocol.NavigationTarget target =
- protocol.newNavigationTarget_fromElement(element, _addFile);
- targets.add(target);
- targetMap[element] = index;
- }
- return index;
- }
-
- int _addFile(String file) {
- int index = fileMap[file];
- if (index == null) {
- index = files.length;
- files.add(file);
- fileMap[file] = index;
- }
- return index;
- }
-
void _addRegion_nodeStart_nodeEnd(AstNode a, AstNode b, Element element) {
int offset = a.offset;
int length = b.end - offset;
@@ -93,6 +81,18 @@ class DartUnitNavigationComputer {
int length = token.length;
_addRegion(offset, length, element);
}
+
+ int _addTarget(Element element) {
+ int index = targetMap[element];
+ if (index == null) {
+ index = targets.length;
+ protocol.NavigationTarget target =
+ protocol.newNavigationTarget_fromElement(element, _addFile);
+ targets.add(target);
+ targetMap[element] = index;
+ }
+ return index;
+ }
}
@@ -245,6 +245,23 @@ class _DartUnitNavigationComputerVisitor extends RecursiveAstVisitor {
computer._addRegionForNode(node, element);
}
+ @override
+ visitSuperConstructorInvocation(SuperConstructorInvocation node) {
+ Element element = node.staticElement;
+ if (element != null && element.isSynthetic) {
+ element = element.enclosingElement;
+ }
+ // add region
+ SimpleIdentifier name = node.constructorName;
+ if (name != null) {
+ computer._addRegion_nodeStart_nodeEnd(node, name, element);
+ } else {
+ computer._addRegionForToken(node.keyword, element);
+ }
+ // process arguments
+ _safelyVisit(node.argumentList);
+ }
+
void _safelyVisit(AstNode node) {
if (node != null) {
node.accept(this);
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis/notification_navigation_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698