Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: pkg/compiler/lib/src/elements/modelx.dart

Issue 2640853005: Make Analyzer, VM and dart2js accept URI strings as part-of library identifier. (Closed)
Patch Set: Add tests, enable flag by default in analyzer. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 if (!localMembers.isEmpty) { 761 if (!localMembers.isEmpty) {
762 reporter.reportErrorMessage(tag, MessageKind.BEFORE_TOP_LEVEL); 762 reporter.reportErrorMessage(tag, MessageKind.BEFORE_TOP_LEVEL);
763 return; 763 return;
764 } 764 }
765 if (partTag != null) { 765 if (partTag != null) {
766 reporter.reportWarningMessage(tag, MessageKind.DUPLICATED_PART_OF); 766 reporter.reportWarningMessage(tag, MessageKind.DUPLICATED_PART_OF);
767 return; 767 return;
768 } 768 }
769 partTag = tag; 769 partTag = tag;
770 LibraryName libraryTag = library.libraryTag; 770 LibraryName libraryTag = library.libraryTag;
771
772 Expression libraryReference = tag.name;
773 if (libraryReference is LiteralString) {
774 // Name is a URI. Resolve and compare to library's URI.
775 String content = libraryReference.dartString.slowToString();
776 Uri uri = this.script.readableUri.resolve(content);
777 Uri expectedUri = library.canonicalUri;
778 if (uri != expectedUri) {
779 // Consider finding a relative URI reference for the error message.
780 reporter.reportWarningMessage(tag.name,
781 MessageKind.LIBRARY_URI_MISMATCH, {'libraryUri': expectedUri});
782 }
783 return;
784 }
771 String actualName = tag.name.toString(); 785 String actualName = tag.name.toString();
772 if (libraryTag != null) { 786 if (libraryTag != null) {
773 String expectedName = libraryTag.name.toString(); 787 String expectedName = libraryTag.name.toString();
774 if (expectedName != actualName) { 788 if (expectedName != actualName) {
775 reporter.reportWarningMessage(tag.name, 789 reporter.reportWarningMessage(tag.name,
776 MessageKind.LIBRARY_NAME_MISMATCH, {'libraryName': expectedName}); 790 MessageKind.LIBRARY_NAME_MISMATCH, {'libraryName': expectedName});
777 } 791 }
778 } else { 792 } else {
779 reporter.reportWarning( 793 reporter.reportWarning(
780 reporter.createMessage(library, MessageKind.MISSING_LIBRARY_NAME, 794 reporter.createMessage(library, MessageKind.MISSING_LIBRARY_NAME,
(...skipping 2685 matching lines...) Expand 10 before | Expand all | Expand 10 after
3466 body = node.asFunctionExpression().body; 3480 body = node.asFunctionExpression().body;
3467 } 3481 }
3468 return new ParsedResolvedAst( 3482 return new ParsedResolvedAst(
3469 declaration, 3483 declaration,
3470 node, 3484 node,
3471 body, 3485 body,
3472 definingElement.treeElements, 3486 definingElement.treeElements,
3473 definingElement.compilationUnit.script.resourceUri); 3487 definingElement.compilationUnit.script.resourceUri);
3474 } 3488 }
3475 } 3489 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698