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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1383483006: Extract DiagnosticReporter implementation from Compiler. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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/cps_ir/cps_ir_builder_task.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
index b8af30dca658b6bd4a02459500ab2c779700957f..bc7e41579b6b71d2305475fd390ef4b2492806ff 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
@@ -15,6 +15,8 @@ import '../compiler.dart' show
Compiler;
import '../constants/expressions.dart';
import '../dart_types.dart';
+import '../diagnostics/diagnostic_listener.dart' show
+ DiagnosticReporter;
import '../diagnostics/invariant.dart' show
invariant;
import '../elements/elements.dart';
@@ -83,7 +85,7 @@ class IrBuilderTask extends CompilerTask {
TreeElements elementsMapping = element.resolvedAst.elements;
element = element.implementation;
- return compiler.withCurrentElement(element, () {
+ return reporter.withCurrentElement(element, () {
SourceInformationBuilder sourceInformationBuilder =
sourceInformationStrategy.createBuilderForContext(element);
@@ -160,6 +162,8 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
this.compiler,
this.sourceInformationBuilder);
+ DiagnosticReporter get reporter => compiler.reporter;
+
String bailoutMessage = null;
@override
@@ -235,14 +239,14 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
ir.Primitive visitBreakStatement(ast.BreakStatement node) {
if (!irBuilder.buildBreak(elements.getTargetOf(node))) {
- compiler.internalError(node, "'break' target not found");
+ reporter.internalError(node, "'break' target not found");
}
return null;
}
ir.Primitive visitContinueStatement(ast.ContinueStatement node) {
if (!irBuilder.buildContinue(elements.getTargetOf(node))) {
- compiler.internalError(node, "'continue' target not found");
+ reporter.internalError(node, "'continue' target not found");
}
return null;
}
@@ -2259,7 +2263,7 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
}
internalError(ast.Node node, String message) {
- compiler.internalError(node, message);
+ reporter.internalError(node, message);
}
@override
@@ -2647,7 +2651,7 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
break;
default:
- compiler.internalError(element, "Unexpected element type $element");
+ reporter.internalError(element, "Unexpected element type $element");
}
return root;
});
@@ -2906,7 +2910,7 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
fieldValues);
hasConstructorCall = true;
} else {
- compiler.internalError(initializer,
+ reporter.internalError(initializer,
"Unexpected initializer type $initializer");
}
}
@@ -2916,7 +2920,7 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
ClassElement superClass = enclosingClass.superclass;
FunctionElement target = superClass.lookupDefaultConstructor();
if (target == null) {
- compiler.internalError(superClass, "No default constructor available.");
+ reporter.internalError(superClass, "No default constructor available.");
}
target = target.implementation;
evaluateConstructorCallFromInitializer(
@@ -3372,7 +3376,7 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
CallStructure callStructure) {
Element element = backend.isolateHelperLibrary.find(helperName);
if (element == null) {
- compiler.internalError(node,
+ reporter.internalError(node,
'Isolate library and compiler mismatch.');
}
List<ir.Primitive> arguments = translateStaticArguments(argumentList,

Powered by Google App Engine
This is Rietveld 408576698