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

Unified Diff: pkg/compiler/lib/src/js_backend/namer.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
Index: pkg/compiler/lib/src/js_backend/namer.dart
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
index afc3d3f2871cfadb871bd729a23581cb68213536..de1279f3a80b7ba9e5048f33367c51f47429730f 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -457,6 +457,8 @@ class Namer {
JavaScriptBackend get backend => compiler.backend;
+ DiagnosticReporter get reporter => compiler.reporter;
+
String get deferredTypesName => 'deferredTypes';
String get isolateName => 'Isolate';
String get isolatePropertiesName => r'$isolateProperties';
@@ -513,7 +515,7 @@ class Namer {
case JsGetName.FUNCTION_CLASS_TYPE_NAME:
return runtimeTypeName(compiler.functionClass);
default:
- compiler.reportErrorMessage(
+ reporter.reportErrorMessage(
node,
MessageKind.GENERIC,
{'text': 'Error: Namer has no name for "$name".'});
@@ -705,7 +707,8 @@ class Namer {
return disambiguatedName; // Methods other than call are not annotated.
default:
- compiler.internalError(compiler.currentElement,
+ reporter.internalError(
+ CURRENT_ELEMENT_SPANNABLE,
'Unexpected selector kind: ${selector.kind}');
return null;
}
@@ -1581,6 +1584,8 @@ class ConstantNamingVisitor implements ConstantValueVisitor {
ConstantNamingVisitor(this.compiler, this.hasher);
+ DiagnosticReporter get reporter => compiler.reporter;
+
String getName(ConstantValue constant) {
_visit(constant);
if (root == null) return 'CONSTANT';
@@ -1743,7 +1748,7 @@ class ConstantNamingVisitor implements ConstantValueVisitor {
add('name');
break;
default:
- compiler.internalError(compiler.currentElement,
+ reporter.internalError(CURRENT_ELEMENT_SPANNABLE,
"Unexpected SyntheticConstantValue");
}
}
@@ -1773,6 +1778,8 @@ class ConstantCanonicalHasher implements ConstantValueVisitor<int, Null> {
ConstantCanonicalHasher(this.compiler);
+ DiagnosticReporter get reporter => compiler.reporter;
+
int getHash(ConstantValue constant) => _visit(constant);
int _visit(ConstantValue constant) {
@@ -1856,9 +1863,10 @@ class ConstantCanonicalHasher implements ConstantValueVisitor<int, Null> {
// resolve to integer indexes, they're always part of a larger constant.
return 0;
default:
- compiler.internalError(NO_LOCATION_SPANNABLE,
- 'SyntheticConstantValue should never be named and '
- 'never be subconstant');
+ reporter.internalError(
+ NO_LOCATION_SPANNABLE,
+ 'SyntheticConstantValue should never be named and '
+ 'never be subconstant');
return 0;
}
}
« no previous file with comments | « pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart ('k') | pkg/compiler/lib/src/js_backend/no_such_method_registry.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698