| 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' show SourceEdit; | 9 import 'package:analysis_server/src/protocol.dart' show SourceEdit; |
| 10 import 'package:analysis_server/src/services/correction/source_range.dart'; | 10 import 'package:analysis_server/src/services/correction/source_range.dart'; |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 * Checks if the given [Element]'s display name equals to the given name. | 412 * Checks if the given [Element]'s display name equals to the given name. |
| 413 */ | 413 */ |
| 414 bool hasDisplayName(Element element, String name) { | 414 bool hasDisplayName(Element element, String name) { |
| 415 if (element == null) { | 415 if (element == null) { |
| 416 return false; | 416 return false; |
| 417 } | 417 } |
| 418 return element.displayName == name; | 418 return element.displayName == name; |
| 419 } | 419 } |
| 420 | 420 |
| 421 /** | 421 /** |
| 422 * Checks if the given [PropertyAccessorElement] is an accessor of a class | 422 * Checks if the given [PropertyAccessorElement] is an accessor of a |
| 423 * [FieldElement]. | 423 * [FieldElement]. |
| 424 */ | 424 */ |
| 425 bool isClassFieldAccessorElement(PropertyAccessorElement accessor) { | 425 bool isFieldAccessorElement(PropertyAccessorElement accessor) { |
| 426 return accessor != null && | 426 return accessor != null && accessor.variable is FieldElement; |
| 427 accessor.variable is FieldElement && | |
| 428 accessor.variable.enclosingElement is ClassElement; | |
| 429 } | 427 } |
| 430 | 428 |
| 431 | 429 |
| 432 /** | 430 /** |
| 433 * Checks if given [DartNode] is the left hand side of an assignment, or a | 431 * Checks if given [DartNode] is the left hand side of an assignment, or a |
| 434 * declaration of a variable. | 432 * declaration of a variable. |
| 435 */ | 433 */ |
| 436 bool isLeftHandOfAssignment(SimpleIdentifier node) { | 434 bool isLeftHandOfAssignment(SimpleIdentifier node) { |
| 437 if (node.inSetterContext()) { | 435 if (node.inSetterContext()) { |
| 438 return true; | 436 return true; |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 | 1367 |
| 1370 @override | 1368 @override |
| 1371 Object visitExpression(Expression node) { | 1369 Object visitExpression(Expression node) { |
| 1372 if (node is BinaryExpression && node.operator.type == groupOperatorType) { | 1370 if (node is BinaryExpression && node.operator.type == groupOperatorType) { |
| 1373 return super.visitNode(node); | 1371 return super.visitNode(node); |
| 1374 } | 1372 } |
| 1375 operands.add(node); | 1373 operands.add(node); |
| 1376 return null; | 1374 return null; |
| 1377 } | 1375 } |
| 1378 } | 1376 } |
| OLD | NEW |