mirror of
https://github.com/dart-lang/sdk
synced 2024-09-21 21:31:19 +00:00
Show import for import of parts.
Closes #24366 R=karlklose@google.com Review URL: https://codereview.chromium.org/1511533002.
This commit is contained in:
parent
db643f5ae2
commit
0413883e0c
|
@ -234,6 +234,7 @@ enum MessageKind {
|
|||
IMPORT_BEFORE_PARTS,
|
||||
IMPORT_EXPERIMENTAL_MIRRORS,
|
||||
IMPORT_PART_OF,
|
||||
IMPORT_PART_OF_HERE,
|
||||
IMPORTED_HERE,
|
||||
INHERIT_GETTER_AND_METHOD,
|
||||
INHERITED_EXPLICIT_GETTER,
|
||||
|
@ -1954,6 +1955,10 @@ main() {}
|
|||
part of library;
|
||||
"""}]),
|
||||
|
||||
MessageKind.IMPORT_PART_OF_HERE:
|
||||
const MessageTemplate(MessageKind.IMPORT_PART_OF_HERE,
|
||||
"The library is imported here."),
|
||||
|
||||
MessageKind.LIBRARY_NAME_MISMATCH:
|
||||
const MessageTemplate(MessageKind.LIBRARY_NAME_MISMATCH,
|
||||
"Expected part of library name '#{libraryName}'.",
|
||||
|
|
|
@ -785,9 +785,9 @@ class CompilationUnitElementX extends ElementX
|
|||
void setPartOf(PartOf tag, DiagnosticReporter reporter) {
|
||||
LibraryElementX library = enclosingElement;
|
||||
if (library.entryCompilationUnit == this) {
|
||||
// This compilation unit is loaded as a library. The error is reported by
|
||||
// the library loader.
|
||||
partTag = tag;
|
||||
reporter.reportErrorMessage(
|
||||
tag, MessageKind.IMPORT_PART_OF);
|
||||
return;
|
||||
}
|
||||
if (!localMembers.isEmpty) {
|
||||
|
|
|
@ -610,6 +610,19 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
|
|||
if (script == null) return null;
|
||||
LibraryElement element =
|
||||
createLibrarySync(handler, script, resolvedUri);
|
||||
CompilationUnitElementX compilationUnit = element.entryCompilationUnit;
|
||||
if (compilationUnit.partTag != null) {
|
||||
DiagnosticMessage error = reporter.withCurrentElement(
|
||||
compilationUnit,
|
||||
() => reporter.createMessage(
|
||||
compilationUnit.partTag, MessageKind.IMPORT_PART_OF));
|
||||
DiagnosticMessage info = reporter.withCurrentElement(
|
||||
importingLibrary,
|
||||
() => reporter.createMessage(
|
||||
node,
|
||||
MessageKind.IMPORT_PART_OF_HERE));
|
||||
reporter.reportError(error, <DiagnosticMessage>[info]);
|
||||
}
|
||||
return processLibraryTags(handler, element).then((_) {
|
||||
reporter.withCurrentElement(element, () {
|
||||
handler.registerLibraryExports(element);
|
||||
|
|
Loading…
Reference in a new issue