| 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 analyzer.src.generated.resolver; | 5 library analyzer.src.generated.resolver; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| (...skipping 3685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3696 usedElements.addElement(element); | 3696 usedElements.addElement(element); |
| 3697 } | 3697 } |
| 3698 | 3698 |
| 3699 static bool _isReadIdentifier(SimpleIdentifier node) { | 3699 static bool _isReadIdentifier(SimpleIdentifier node) { |
| 3700 // not reading at all | 3700 // not reading at all |
| 3701 if (!node.inGetterContext()) { | 3701 if (!node.inGetterContext()) { |
| 3702 return false; | 3702 return false; |
| 3703 } | 3703 } |
| 3704 // check if useless reading | 3704 // check if useless reading |
| 3705 AstNode parent = node.parent; | 3705 AstNode parent = node.parent; |
| 3706 if (parent.parent is ExpressionStatement && | 3706 if (parent.parent is ExpressionStatement) { |
| 3707 (parent is PrefixExpression || | 3707 if (parent is PrefixExpression || parent is PostfixExpression) { |
| 3708 parent is PostfixExpression || | 3708 // v++; |
| 3709 parent is AssignmentExpression && parent.leftHandSide == node)) { | 3709 // ++v; |
| 3710 // v++; | 3710 return false; |
| 3711 // ++v; | 3711 } |
| 3712 // v += 2; | 3712 if (parent is AssignmentExpression && parent.leftHandSide == node) { |
| 3713 return false; | 3713 // v ??= doSomething(); |
| 3714 // vs. |
| 3715 // v += 2; |
| 3716 TokenType operatorType = parent.operator?.type; |
| 3717 return operatorType == TokenType.QUESTION_QUESTION_EQ; |
| 3718 } |
| 3714 } | 3719 } |
| 3715 // OK | 3720 // OK |
| 3716 return true; | 3721 return true; |
| 3717 } | 3722 } |
| 3718 } | 3723 } |
| 3719 | 3724 |
| 3720 /** | 3725 /** |
| 3721 * Instances of the class `HintGenerator` traverse a library's worth of dart cod
e at a time to | 3726 * Instances of the class `HintGenerator` traverse a library's worth of dart cod
e at a time to |
| 3722 * generate hints over the set of sources. | 3727 * generate hints over the set of sources. |
| 3723 * | 3728 * |
| (...skipping 7209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10933 return null; | 10938 return null; |
| 10934 } | 10939 } |
| 10935 if (identical(node.staticElement, variable)) { | 10940 if (identical(node.staticElement, variable)) { |
| 10936 if (node.inSetterContext()) { | 10941 if (node.inSetterContext()) { |
| 10937 result = true; | 10942 result = true; |
| 10938 } | 10943 } |
| 10939 } | 10944 } |
| 10940 return null; | 10945 return null; |
| 10941 } | 10946 } |
| 10942 } | 10947 } |
| OLD | NEW |