Chromium Code Reviews| 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.error_verifier; | 5 library analyzer.src.generated.error_verifier; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import "dart:math" as math; | 8 import "dart:math" as math; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 2688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2699 constructor, | 2699 constructor, |
| 2700 [name]); | 2700 [name]); |
| 2701 } | 2701 } |
| 2702 return; | 2702 return; |
| 2703 } | 2703 } |
| 2704 } | 2704 } |
| 2705 // conflict with class member | 2705 // conflict with class member |
| 2706 if (constructorName != null && | 2706 if (constructorName != null && |
| 2707 constructorElement != null && | 2707 constructorElement != null && |
| 2708 !constructorName.isSynthetic) { | 2708 !constructorName.isSynthetic) { |
| 2709 if (classElement.getField(name) != null) { | 2709 FieldElement field = classElement.getField(name); |
| 2710 // fields | 2710 if (field != null && field.getter != null) { |
|
scheglov
2017/01/18 17:11:52
Could you add a couple of unit tests to analyzer?
asgerf
2017/01/18 18:18:34
Absolutely! Thanks for writing them.
| |
| 2711 _errorReporter.reportErrorForNode( | 2711 _errorReporter.reportErrorForNode( |
| 2712 CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD, | 2712 CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD, |
| 2713 constructor, | 2713 constructor, |
| 2714 [name]); | 2714 [name]); |
| 2715 } else if (classElement.getMethod(name) != null) { | 2715 } else if (classElement.getMethod(name) != null) { |
| 2716 // methods | 2716 // methods |
| 2717 _errorReporter.reportErrorForNode( | 2717 _errorReporter.reportErrorForNode( |
| 2718 CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD, | 2718 CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD, |
| 2719 constructor, | 2719 constructor, |
| 2720 [name]); | 2720 [name]); |
| (...skipping 4285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7006 class _InvocationCollector extends RecursiveAstVisitor { | 7006 class _InvocationCollector extends RecursiveAstVisitor { |
| 7007 final List<String> superCalls = <String>[]; | 7007 final List<String> superCalls = <String>[]; |
| 7008 | 7008 |
| 7009 @override | 7009 @override |
| 7010 visitMethodInvocation(MethodInvocation node) { | 7010 visitMethodInvocation(MethodInvocation node) { |
| 7011 if (node.target is SuperExpression) { | 7011 if (node.target is SuperExpression) { |
| 7012 superCalls.add(node.methodName.name); | 7012 superCalls.add(node.methodName.name); |
| 7013 } | 7013 } |
| 7014 } | 7014 } |
| 7015 } | 7015 } |
| OLD | NEW |