| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 elements.modelx; | 5 library elements.modelx; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/names.dart' show Identifiers; | 8 import '../common/names.dart' show Identifiers; |
| 9 import '../common/resolution.dart' show Resolution, ParsingContext; | 9 import '../common/resolution.dart' show Resolution, ParsingContext; |
| 10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 if (!localMembers.isEmpty) { | 760 if (!localMembers.isEmpty) { |
| 761 reporter.reportErrorMessage(tag, MessageKind.BEFORE_TOP_LEVEL); | 761 reporter.reportErrorMessage(tag, MessageKind.BEFORE_TOP_LEVEL); |
| 762 return; | 762 return; |
| 763 } | 763 } |
| 764 if (partTag != null) { | 764 if (partTag != null) { |
| 765 reporter.reportWarningMessage(tag, MessageKind.DUPLICATED_PART_OF); | 765 reporter.reportWarningMessage(tag, MessageKind.DUPLICATED_PART_OF); |
| 766 return; | 766 return; |
| 767 } | 767 } |
| 768 partTag = tag; | 768 partTag = tag; |
| 769 LibraryName libraryTag = library.libraryTag; | 769 LibraryName libraryTag = library.libraryTag; |
| 770 | |
| 771 Expression libraryReference = tag.name; | |
| 772 if (libraryReference is LiteralString) { | |
| 773 // Name is a URI. Resolve and compare to library's URI. | |
| 774 String content = libraryReference.dartString.slowToString(); | |
| 775 Uri uri = this.script.readableUri.resolve(content); | |
| 776 Uri expectedUri = library.canonicalUri; | |
| 777 if (uri != expectedUri) { | |
| 778 // Consider finding a relative URI reference for the error message. | |
| 779 reporter.reportWarningMessage(tag.name, | |
| 780 MessageKind.LIBRARY_URI_MISMATCH, {'libraryUri': expectedUri}); | |
| 781 } | |
| 782 return; | |
| 783 } | |
| 784 String actualName = tag.name.toString(); | 770 String actualName = tag.name.toString(); |
| 785 if (libraryTag != null) { | 771 if (libraryTag != null) { |
| 786 String expectedName = libraryTag.name.toString(); | 772 String expectedName = libraryTag.name.toString(); |
| 787 if (expectedName != actualName) { | 773 if (expectedName != actualName) { |
| 788 reporter.reportWarningMessage(tag.name, | 774 reporter.reportWarningMessage(tag.name, |
| 789 MessageKind.LIBRARY_NAME_MISMATCH, {'libraryName': expectedName}); | 775 MessageKind.LIBRARY_NAME_MISMATCH, {'libraryName': expectedName}); |
| 790 } | 776 } |
| 791 } else { | 777 } else { |
| 792 reporter.reportWarning( | 778 reporter.reportWarning( |
| 793 reporter.createMessage(library, MessageKind.MISSING_LIBRARY_NAME, | 779 reporter.createMessage(library, MessageKind.MISSING_LIBRARY_NAME, |
| (...skipping 2687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3481 body = node.asFunctionExpression().body; | 3467 body = node.asFunctionExpression().body; |
| 3482 } | 3468 } |
| 3483 return new ParsedResolvedAst( | 3469 return new ParsedResolvedAst( |
| 3484 declaration, | 3470 declaration, |
| 3485 node, | 3471 node, |
| 3486 body, | 3472 body, |
| 3487 definingElement.treeElements, | 3473 definingElement.treeElements, |
| 3488 definingElement.compilationUnit.script.resourceUri); | 3474 definingElement.compilationUnit.script.resourceUri); |
| 3489 } | 3475 } |
| 3490 } | 3476 } |
| OLD | NEW |