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

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

Issue 694383003: Issue 21498. Fix for navigation from instance creation with type arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
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 a21ec59adb80314b1c29f5216ab18da69c590a92..faf949d5580092d902701ed99bb625e3e7c1df87 100644
--- a/pkg/analysis_server/lib/src/computer/computer_navigation.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_navigation.dart
@@ -163,29 +163,25 @@ class _DartUnitNavigationComputerVisitor extends RecursiveAstVisitor {
Element element = node.staticElement;
ConstructorName constructorName = node.constructorName;
if (element != null && constructorName != null) {
- ClassElement classElement = element.enclosingElement;
+ // if a synthetic constructor, navigate to the class
if (element.isSynthetic) {
+ ClassElement classElement = element.enclosingElement;
element = classElement;
- computer._addRegion_nodeStart_nodeStart(
- node,
- node.argumentList,
+ }
+ // "new ", excluding last character
+ computer._addRegion_nodeStart_nodeStart(
+ node,
+ constructorName.type,
+ element,
+ excludeLastChar: true);
+ // "ClassName<TypeA, TypeB>"
+ _safelyVisit(constructorName.type);
+ // optional ".name"
+ if (constructorName.period != null) {
+ computer._addRegion_tokenStart_nodeEnd(
+ constructorName.period,
+ constructorName,
element);
- } else {
- // "new ", excluding last character
- computer._addRegion_nodeStart_nodeStart(
- node,
- constructorName.type,
- element,
- excludeLastChar: true);
- // "ClassName"
- computer._addRegionForNode(constructorName.type, classElement);
- // optional ".name"
- if (constructorName.period != null) {
- computer._addRegion_tokenStart_nodeEnd(
- constructorName.period,
- constructorName,
- element);
- }
}
}
_safelyVisit(node.argumentList);

Powered by Google App Engine
This is Rietveld 408576698