| 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 engine.resolver.error_verifier; | 5 library engine.resolver.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/src/generated/static_type_analyzer.dart'; | 10 import 'package:analyzer/src/generated/static_type_analyzer.dart'; |
| (...skipping 2981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2992 bool _checkForExportDuplicateLibraryName(ExportDirective directive, | 2992 bool _checkForExportDuplicateLibraryName(ExportDirective directive, |
| 2993 ExportElement exportElement, LibraryElement exportedLibrary) { | 2993 ExportElement exportElement, LibraryElement exportedLibrary) { |
| 2994 if (exportedLibrary == null) { | 2994 if (exportedLibrary == null) { |
| 2995 return false; | 2995 return false; |
| 2996 } | 2996 } |
| 2997 String name = exportedLibrary.name; | 2997 String name = exportedLibrary.name; |
| 2998 // check if there is other exported library with the same name | 2998 // check if there is other exported library with the same name |
| 2999 LibraryElement prevLibrary = _nameToExportElement[name]; | 2999 LibraryElement prevLibrary = _nameToExportElement[name]; |
| 3000 if (prevLibrary != null) { | 3000 if (prevLibrary != null) { |
| 3001 if (prevLibrary != exportedLibrary) { | 3001 if (prevLibrary != exportedLibrary) { |
| 3002 if (name.isEmpty) { | 3002 if (!name.isEmpty) { |
| 3003 _errorReporter.reportErrorForNode( | |
| 3004 StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_UNNAMED, directive, [ | |
| 3005 prevLibrary.definingCompilationUnit.displayName, | |
| 3006 exportedLibrary.definingCompilationUnit.displayName | |
| 3007 ]); | |
| 3008 } else { | |
| 3009 _errorReporter.reportErrorForNode( | 3003 _errorReporter.reportErrorForNode( |
| 3010 StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAMED, directive, [ | 3004 StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAMED, directive, [ |
| 3011 prevLibrary.definingCompilationUnit.displayName, | 3005 prevLibrary.definingCompilationUnit.displayName, |
| 3012 exportedLibrary.definingCompilationUnit.displayName, | 3006 exportedLibrary.definingCompilationUnit.displayName, |
| 3013 name | 3007 name |
| 3014 ]); | 3008 ]); |
| 3015 } | 3009 } |
| 3016 return true; | 3010 return true; |
| 3017 } | 3011 } |
| 3018 } else { | 3012 } else { |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3505 // prepare imported library | 3499 // prepare imported library |
| 3506 LibraryElement nodeLibrary = importElement.importedLibrary; | 3500 LibraryElement nodeLibrary = importElement.importedLibrary; |
| 3507 if (nodeLibrary == null) { | 3501 if (nodeLibrary == null) { |
| 3508 return false; | 3502 return false; |
| 3509 } | 3503 } |
| 3510 String name = nodeLibrary.name; | 3504 String name = nodeLibrary.name; |
| 3511 // check if there is another imported library with the same name | 3505 // check if there is another imported library with the same name |
| 3512 LibraryElement prevLibrary = _nameToImportElement[name]; | 3506 LibraryElement prevLibrary = _nameToImportElement[name]; |
| 3513 if (prevLibrary != null) { | 3507 if (prevLibrary != null) { |
| 3514 if (prevLibrary != nodeLibrary) { | 3508 if (prevLibrary != nodeLibrary) { |
| 3515 if (name.isEmpty) { | 3509 if (!name.isEmpty) { |
| 3516 _errorReporter.reportErrorForNode( | |
| 3517 StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_UNNAMED, directive, [ | |
| 3518 prevLibrary.definingCompilationUnit.displayName, | |
| 3519 nodeLibrary.definingCompilationUnit.displayName | |
| 3520 ]); | |
| 3521 } else { | |
| 3522 _errorReporter.reportErrorForNode( | 3510 _errorReporter.reportErrorForNode( |
| 3523 StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAMED, directive, [ | 3511 StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAMED, directive, [ |
| 3524 prevLibrary.definingCompilationUnit.displayName, | 3512 prevLibrary.definingCompilationUnit.displayName, |
| 3525 nodeLibrary.definingCompilationUnit.displayName, | 3513 nodeLibrary.definingCompilationUnit.displayName, |
| 3526 name | 3514 name |
| 3527 ]); | 3515 ]); |
| 3528 } | 3516 } |
| 3529 return true; | 3517 return true; |
| 3530 } | 3518 } |
| 3531 } else { | 3519 } else { |
| (...skipping 2460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5992 toCheck.add(type.element); | 5980 toCheck.add(type.element); |
| 5993 // type arguments | 5981 // type arguments |
| 5994 if (type is InterfaceType) { | 5982 if (type is InterfaceType) { |
| 5995 InterfaceType interfaceType = type; | 5983 InterfaceType interfaceType = type; |
| 5996 for (DartType typeArgument in interfaceType.typeArguments) { | 5984 for (DartType typeArgument in interfaceType.typeArguments) { |
| 5997 _addTypeToCheck(typeArgument); | 5985 _addTypeToCheck(typeArgument); |
| 5998 } | 5986 } |
| 5999 } | 5987 } |
| 6000 } | 5988 } |
| 6001 } | 5989 } |
| OLD | NEW |