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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/library_loader.dart

Issue 20742002: Clean up error handling. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added documentation guide lines. Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: dart/sdk/lib/_internal/compiler/implementation/library_loader.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/library_loader.dart b/dart/sdk/lib/_internal/compiler/implementation/library_loader.dart
index 0e70958a74d6299085472ea2feec45a6f276cbfe..0bcd1a51ca3f377c5f4de13601372de47740c680 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/library_loader.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/library_loader.dart
@@ -255,7 +255,9 @@ class LibraryLoaderTask extends LibraryLoader {
*/
int checkTag(int value, LibraryTag tag) {
if (tagState > value) {
- compiler.reportError(tag, 'out of order');
+ compiler.reportFatalError(
+ tag,
+ MessageKind.GENERIC, {'text': 'Error: Out of order.'});
return tagState;
}
return TagState.NEXT[value];
@@ -397,8 +399,11 @@ class LibraryLoaderTask extends LibraryLoader {
if (!loadedLibrary.hasLibraryName()) {
compiler.withCurrentElement(library, () {
- compiler.reportError(tag == null ? null : tag.uri,
- 'no library name found in ${loadedLibrary.canonicalUri}');
+ compiler.reportFatalError(
+ tag == null ? null : tag.uri,
+ MessageKind.GENERIC,
+ {'text':
+ 'Error: No library name found in ${loadedLibrary.canonicalUri}.'});
});
}
}
@@ -505,7 +510,9 @@ class ImportLink {
compiler.reportWarning(new Identifier(e.position()),
'duplicated definition');
});
- compiler.reportError(import.prefix, 'duplicate definition');
+ compiler.reportFatalError(
+ import.prefix,
+ MessageKind.GENERIC, {'text': 'Error: Duplicate definition.'});
}
PrefixElement prefixElement = e;
importedLibrary.forEachExport((Element element) {
@@ -519,8 +526,9 @@ class ImportLink {
'duplicated import');
});
compiler.withCurrentElement(element, () {
- compiler.reportError(new Identifier(element.position()),
- 'duplicated import');
+ compiler.reportFatalError(
+ element,
+ MessageKind.GENERIC, {'text': 'Error: Duplicated import.'});
});
}
});
@@ -675,15 +683,15 @@ class LibraryDependencyNode {
Element existingElement = exportScope[name];
if (existingElement != null) {
if (existingElement.isErroneous()) {
- compiler.reportErrorCode(element, MessageKind.DUPLICATE_EXPORT,
- {'name': name});
+ compiler.reportError(element, MessageKind.DUPLICATE_EXPORT,
+ {'name': name});
element = existingElement;
} else if (existingElement.getLibrary() != library) {
// Declared elements hide exported elements.
- compiler.reportErrorCode(existingElement, MessageKind.DUPLICATE_EXPORT,
- {'name': name});
- compiler.reportErrorCode(element, MessageKind.DUPLICATE_EXPORT,
- {'name': name});
+ compiler.reportError(existingElement, MessageKind.DUPLICATE_EXPORT,
+ {'name': name});
+ compiler.reportError(element, MessageKind.DUPLICATE_EXPORT,
+ {'name': name});
element = exportScope[name] = new ErroneousElementX(
MessageKind.DUPLICATE_EXPORT, {'name': name}, name, library);
}

Powered by Google App Engine
This is Rietveld 408576698