Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'package:analyzer/context/declared_variables.dart'; | 5 import 'package:analyzer/context/declared_variables.dart'; |
| 6 import 'package:analyzer/dart/ast/ast.dart'; | 6 import 'package:analyzer/dart/ast/ast.dart'; |
| 7 import 'package:analyzer/dart/ast/visitor.dart'; | 7 import 'package:analyzer/dart/ast/visitor.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/error/error.dart'; | 9 import 'package:analyzer/error/error.dart'; |
| 10 import 'package:analyzer/error/listener.dart'; | 10 import 'package:analyzer/error/listener.dart'; |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 477 partUri, | 477 partUri, |
| 478 [partUri.toSource()]); | 478 [partUri.toSource()]); |
| 479 } else { | 479 } else { |
| 480 String name = nameOrSource.name; | 480 String name = nameOrSource.name; |
| 481 if (name != null) { | 481 if (name != null) { |
| 482 if (libraryNameNode != null && libraryNameNode.name != name) { | 482 if (libraryNameNode != null && libraryNameNode.name != name) { |
| 483 libraryErrorReporter.reportErrorForNode( | 483 libraryErrorReporter.reportErrorForNode( |
| 484 StaticWarningCode.PART_OF_DIFFERENT_LIBRARY, | 484 StaticWarningCode.PART_OF_DIFFERENT_LIBRARY, |
| 485 partUri, | 485 partUri, |
| 486 [libraryNameNode.name, name]); | 486 [libraryNameNode.name, name]); |
| 487 } else if (libraryNameNode == null) { | |
| 488 libraryErrorReporter.reportErrorForNode( | |
| 489 StaticWarningCode.PART_OF_UNNAMED_LIBRARY, partUri, [name]); | |
|
Lasse Reichstein Nielsen
2017/06/08 19:31:19
Logic seems backwards.
Put the second branch first
floitsch
2017/06/08 19:47:33
Done.
| |
| 487 } | 490 } |
| 488 } else { | 491 } else { |
| 489 Source source = nameOrSource.source; | 492 Source source = nameOrSource.source; |
| 490 if (source != _library.source) { | 493 if (source != _library.source) { |
| 491 libraryErrorReporter.reportErrorForNode( | 494 libraryErrorReporter.reportErrorForNode( |
| 492 StaticWarningCode.PART_OF_DIFFERENT_LIBRARY, | 495 StaticWarningCode.PART_OF_DIFFERENT_LIBRARY, |
| 493 partUri, | 496 partUri, |
| 494 [_library.uriStr, source.uri]); | 497 [_library.uriStr, source.uri]); |
| 495 } | 498 } |
| 496 } | 499 } |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 796 } | 799 } |
| 797 | 800 |
| 798 /** | 801 /** |
| 799 * Either the name or the source associated with a part-of directive. | 802 * Either the name or the source associated with a part-of directive. |
| 800 */ | 803 */ |
| 801 class _NameOrSource { | 804 class _NameOrSource { |
| 802 final String name; | 805 final String name; |
| 803 final Source source; | 806 final Source source; |
| 804 _NameOrSource(this.name, this.source); | 807 _NameOrSource(this.name, this.source); |
| 805 } | 808 } |
| OLD | NEW |