OLD | NEW |
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 services.src.correction.util; | 5 library services.src.correction.util; |
6 | 6 |
7 import 'dart:math'; | 7 import 'dart:math'; |
8 | 8 |
9 import 'package:analysis_server/src/protocol.dart' | 9 import 'package:analysis_server/src/protocol.dart' |
10 show SourceChange, SourceEdit; | 10 show SourceChange, SourceEdit; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 */ | 168 */ |
169 String getElementKindName(Element element) { | 169 String getElementKindName(Element element) { |
170 return element.kind.displayName; | 170 return element.kind.displayName; |
171 } | 171 } |
172 | 172 |
173 /** | 173 /** |
174 * Returns the name to display in the UI for the given [Element]. | 174 * Returns the name to display in the UI for the given [Element]. |
175 */ | 175 */ |
176 String getElementQualifiedName(Element element) { | 176 String getElementQualifiedName(Element element) { |
177 ElementKind kind = element.kind; | 177 ElementKind kind = element.kind; |
178 if (kind == ElementKind.FIELD || kind == ElementKind.METHOD) { | 178 if (kind == ElementKind.CONSTRUCTOR || |
| 179 kind == ElementKind.FIELD || |
| 180 kind == ElementKind.METHOD) { |
179 return '${element.enclosingElement.displayName}.${element.displayName}'; | 181 return '${element.enclosingElement.displayName}.${element.displayName}'; |
180 } else { | 182 } else { |
181 return element.displayName; | 183 return element.displayName; |
182 } | 184 } |
183 } | 185 } |
184 | 186 |
185 /** | 187 /** |
186 * If the given [AstNode] is in a [ClassDeclaration], returns the | 188 * If the given [AstNode] is in a [ClassDeclaration], returns the |
187 * [ClassElement]. Otherwise returns `null`. | 189 * [ClassElement]. Otherwise returns `null`. |
188 */ | 190 */ |
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 | 1565 |
1564 @override | 1566 @override |
1565 Object visitExpression(Expression node) { | 1567 Object visitExpression(Expression node) { |
1566 if (node is BinaryExpression && node.operator.type == groupOperatorType) { | 1568 if (node is BinaryExpression && node.operator.type == groupOperatorType) { |
1567 return super.visitNode(node); | 1569 return super.visitNode(node); |
1568 } | 1570 } |
1569 operands.add(node); | 1571 operands.add(node); |
1570 return null; | 1572 return null; |
1571 } | 1573 } |
1572 } | 1574 } |
OLD | NEW |