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

Side by Side Diff: pkg/analysis_server/lib/src/computer/computer_hover.dart

Issue 1131423002: Clean up many generated constructors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comment change Created 5 years, 7 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
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 computer.hover; 5 library computer.hover;
6 6
7 import 'package:analysis_server/src/protocol.dart' show HoverInformation; 7 import 'package:analysis_server/src/protocol.dart' show HoverInformation;
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/element.dart'; 9 import 'package:analyzer/src/generated/element.dart';
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 class DartUnitHoverComputer { 58 class DartUnitHoverComputer {
59 final CompilationUnit _unit; 59 final CompilationUnit _unit;
60 final int _offset; 60 final int _offset;
61 61
62 DartUnitHoverComputer(this._unit, this._offset); 62 DartUnitHoverComputer(this._unit, this._offset);
63 63
64 /** 64 /**
65 * Returns the computed hover, maybe `null`. 65 * Returns the computed hover, maybe `null`.
66 */ 66 */
67 HoverInformation compute() { 67 HoverInformation compute() {
68 AstNode node = new NodeLocator.con1(_offset).searchWithin(_unit); 68 AstNode node = new NodeLocator(_offset).searchWithin(_unit);
69 if (node == null) { 69 if (node == null) {
70 return null; 70 return null;
71 } 71 }
72 if (node.parent is TypeName && 72 if (node.parent is TypeName &&
73 node.parent.parent is ConstructorName && 73 node.parent.parent is ConstructorName &&
74 node.parent.parent.parent is InstanceCreationExpression) { 74 node.parent.parent.parent is InstanceCreationExpression) {
75 node = node.parent.parent.parent; 75 node = node.parent.parent.parent;
76 } 76 }
77 if (node.parent is ConstructorName && 77 if (node.parent is ConstructorName &&
78 node.parent.parent is InstanceCreationExpression) { 78 node.parent.parent is InstanceCreationExpression) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 hover.propagatedType = _safeToString(expression.propagatedType); 122 hover.propagatedType = _safeToString(expression.propagatedType);
123 // done 123 // done
124 return hover; 124 return hover;
125 } 125 }
126 // not an expression 126 // not an expression
127 return null; 127 return null;
128 } 128 }
129 129
130 static _safeToString(obj) => obj != null ? obj.toString() : null; 130 static _safeToString(obj) => obj != null ? obj.toString() : null;
131 } 131 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/lib/src/operation/operation_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698