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

Unified Diff: pkg/compiler/lib/src/js_emitter/metadata_collector.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_emitter/metadata_collector.dart
diff --git a/pkg/compiler/lib/src/js_emitter/metadata_collector.dart b/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
index af554558ebedc39e5efd908eae704929202b8ddb..e0a9b03bec7de32797f526f4af0fef9661fd6c5f 100644
--- a/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
+++ b/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
@@ -145,6 +145,7 @@ class MetadataCollector implements jsAst.TokenFinalizer {
JavaScriptBackend get _backend => _compiler.backend;
TypeVariableHandler get _typeVariableHandler => _backend.typeVariableHandler;
+ DiagnosticReporter get reporter => _compiler.reporter;
bool _mustEmitMetadataFor(Element element) {
return _backend.mustRetainMetadata &&
@@ -159,13 +160,13 @@ class MetadataCollector implements jsAst.TokenFinalizer {
/// mirrors_patch to implement DeclarationMirror.metadata.
jsAst.Fun buildMetadataFunction(Element element) {
if (!_mustEmitMetadataFor(element)) return null;
- return _compiler.withCurrentElement(element, () {
+ return reporter.withCurrentElement(element, () {
List<jsAst.Expression> metadata = <jsAst.Expression>[];
for (MetadataAnnotation annotation in element.metadata) {
ConstantValue constant =
_backend.constants.getConstantValueForMetadata(annotation);
if (constant == null) {
- _compiler.internalError(annotation, 'Annotation value is null.');
+ reporter.internalError(annotation, 'Annotation value is null.');
} else {
metadata.add(_emitter.constantReference(constant));
}
@@ -195,7 +196,7 @@ class MetadataCollector implements jsAst.TokenFinalizer {
ConstantValue constant =
_backend.constants.getConstantValueForMetadata(annotation);
if (constant == null) {
- _compiler.internalError(annotation, 'Annotation value is null.');
+ reporter.internalError(annotation, 'Annotation value is null.');
return null;
}
return _addGlobalMetadata(_emitter.constantReference(constant));
@@ -255,7 +256,7 @@ class MetadataCollector implements jsAst.TokenFinalizer {
if (representation is jsAst.LiteralString) {
// We don't want the representation to be a string, since we use
// strings as indicator for non-initialized types in the lazy emitter.
- _compiler.internalError(
+ reporter.internalError(
NO_LOCATION_SPANNABLE, 'reified types should not be strings.');
}
@@ -281,7 +282,7 @@ class MetadataCollector implements jsAst.TokenFinalizer {
}
List<jsAst.DeferredNumber> computeMetadata(FunctionElement element) {
- return _compiler.withCurrentElement(element, () {
+ return reporter.withCurrentElement(element, () {
if (!_mustEmitMetadataFor(element)) return const <jsAst.DeferredNumber>[];
List<jsAst.DeferredNumber> metadata = <jsAst.DeferredNumber>[];
for (MetadataAnnotation annotation in element.metadata) {

Powered by Google App Engine
This is Rietveld 408576698