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

Unified Diff: pkg/compiler/lib/src/apiimpl.dart

Issue 1383483006: Extract DiagnosticReporter implementation from Compiler. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fixes after rebase. Created 5 years, 2 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/closure.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/apiimpl.dart
diff --git a/pkg/compiler/lib/src/apiimpl.dart b/pkg/compiler/lib/src/apiimpl.dart
index 61e472428013a04ec5dde6a3fe413b968af74c5e..1fc10e38df5a398ba7af21dd7064d84a2394e813 100644
--- a/pkg/compiler/lib/src/apiimpl.dart
+++ b/pkg/compiler/lib/src/apiimpl.dart
@@ -235,7 +235,7 @@ class Compiler extends leg.Compiler {
Future<Script> readScript(Spannable node, Uri readableUri) {
if (!readableUri.isAbsolute) {
if (node == null) node = NO_LOCATION_SPANNABLE;
- internalError(node,
+ reporter.internalError(node,
'Relative uri $readableUri provided to readScript(Uri).');
}
@@ -245,13 +245,13 @@ class Compiler extends leg.Compiler {
elements.Element element = currentElement;
void reportReadError(exception) {
if (element == null || node == null) {
- reportErrorMessage(
+ reporter.reportErrorMessage(
new SourceSpan(readableUri, 0, 0),
MessageKind.READ_SELF_ERROR,
{'uri': readableUri, 'exception': exception});
} else {
- withCurrentElement(element, () {
- reportErrorMessage(
+ reporter.withCurrentElement(element, () {
+ reporter.reportErrorMessage(
node,
MessageKind.READ_SCRIPT_ERROR,
{'uri': readableUri, 'exception': exception});
@@ -263,8 +263,8 @@ class Compiler extends leg.Compiler {
if (resourceUri == null) return synthesizeScript(node, readableUri);
if (resourceUri.scheme == 'dart-ext') {
if (!allowNativeExtensions) {
- withCurrentElement(element, () {
- reportErrorMessage(
+ reporter.withCurrentElement(element, () {
+ reporter.reportErrorMessage(
node, MessageKind.DART_EXT_NOT_SUPPORTED);
});
}
@@ -335,13 +335,13 @@ class Compiler extends leg.Compiler {
}
if (!allowInternalLibraryAccess) {
if (importingLibrary != null) {
- reportErrorMessage(
+ reporter.reportErrorMessage(
spannable,
MessageKind.INTERNAL_LIBRARY_FROM,
{'resolvedUri': resolvedUri,
'importingUri': importingLibrary.canonicalUri});
} else {
- reportErrorMessage(
+ reporter.reportErrorMessage(
spannable,
MessageKind.INTERNAL_LIBRARY,
{'resolvedUri': resolvedUri});
@@ -350,12 +350,12 @@ class Compiler extends leg.Compiler {
}
if (path == null) {
if (libraryInfo == null) {
- reportErrorMessage(
+ reporter.reportErrorMessage(
spannable,
MessageKind.LIBRARY_NOT_FOUND,
{'resolvedUri': resolvedUri});
} else {
- reportErrorMessage(
+ reporter.reportErrorMessage(
spannable,
MessageKind.LIBRARY_NOT_SUPPORTED,
{'resolvedUri': resolvedUri});
@@ -383,7 +383,7 @@ class Compiler extends leg.Compiler {
try {
checkValidPackageUri(uri);
} on ArgumentError catch (e) {
- reportErrorMessage(
+ reporter.reportErrorMessage(
node,
MessageKind.INVALID_PACKAGE_URI,
{'uri': uri, 'exception': e.message});
@@ -391,7 +391,7 @@ class Compiler extends leg.Compiler {
}
return packages.resolve(uri,
notFound: (Uri notFound) {
- reportErrorMessage(
+ reporter.reportErrorMessage(
node,
MessageKind.LIBRARY_NOT_FOUND,
{'resolvedUri': uri});
@@ -429,7 +429,7 @@ class Compiler extends leg.Compiler {
packages =
new MapPackages(pkgs.parse(packageConfigContents, packageConfig));
}).catchError((error) {
- reportErrorMessage(
+ reporter.reportErrorMessage(
NO_LOCATION_SPANNABLE,
MessageKind.INVALID_PACKAGE_CONFIG,
{'uri': packageConfig, 'exception': error});
@@ -539,11 +539,6 @@ class Compiler extends leg.Compiler {
}
}
- void diagnoseCrashInUserCode(String message, exception, stackTrace) {
- hasCrashed = true;
- print('$message: ${tryToString(exception)}');
- print(tryToString(stackTrace));
- }
fromEnvironment(String name) => environment[name];
« no previous file with comments | « no previous file | pkg/compiler/lib/src/closure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698