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 } |
770 String actualName = tag.name.toString(); | 784 String actualName = tag.name.toString(); |
771 if (libraryTag != null) { | 785 if (libraryTag != null) { |
772 String expectedName = libraryTag.name.toString(); | 786 String expectedName = libraryTag.name.toString(); |
773 if (expectedName != actualName) { | 787 if (expectedName != actualName) { |
774 reporter.reportWarningMessage(tag.name, | 788 reporter.reportWarningMessage(tag.name, |
775 MessageKind.LIBRARY_NAME_MISMATCH, {'libraryName': expectedName}); | 789 MessageKind.LIBRARY_NAME_MISMATCH, {'libraryName': expectedName}); |
776 } | 790 } |
777 } else { | 791 } else { |
778 reporter.reportWarning( | 792 reporter.reportWarning( |
779 reporter.createMessage(library, MessageKind.MISSING_LIBRARY_NAME, | 793 reporter.createMessage(library, MessageKind.MISSING_LIBRARY_NAME, |
(...skipping 2687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3467 body = node.asFunctionExpression().body; | 3481 body = node.asFunctionExpression().body; |
3468 } | 3482 } |
3469 return new ParsedResolvedAst( | 3483 return new ParsedResolvedAst( |
3470 declaration, | 3484 declaration, |
3471 node, | 3485 node, |
3472 body, | 3486 body, |
3473 definingElement.treeElements, | 3487 definingElement.treeElements, |
3474 definingElement.compilationUnit.script.resourceUri); | 3488 definingElement.compilationUnit.script.resourceUri); |
3475 } | 3489 } |
3476 } | 3490 } |
OLD | NEW |