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

Unified Diff: pkg/compiler/lib/src/resolution/resolution_common.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 | « pkg/compiler/lib/src/resolution/resolution.dart ('k') | pkg/compiler/lib/src/resolution/signatures.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/resolution/resolution_common.dart
diff --git a/pkg/compiler/lib/src/resolution/resolution_common.dart b/pkg/compiler/lib/src/resolution/resolution_common.dart
index 8e1845dc425f21c7da4956e36b5b0c785f49d9a6..1b0b6b5eb655df2d56a54c740188bc18a02c53a5 100644
--- a/pkg/compiler/lib/src/resolution/resolution_common.dart
+++ b/pkg/compiler/lib/src/resolution/resolution_common.dart
@@ -11,7 +11,8 @@ import '../common/tasks.dart' show
import '../compiler.dart' show
Compiler;
import '../diagnostics/diagnostic_listener.dart' show
- DiagnosticMessage;
+ DiagnosticMessage,
+ DiagnosticReporter;
import '../diagnostics/messages.dart' show
MessageKind;
import '../diagnostics/spannable.dart' show
@@ -31,10 +32,12 @@ class CommonResolverVisitor<R> extends Visitor<R> {
CommonResolverVisitor(Compiler this.compiler);
+ DiagnosticReporter get reporter => compiler.reporter;
+
Resolution get resolution => compiler.resolution;
R visitNode(Node node) {
- return compiler.internalError(node,
+ return reporter.internalError(node,
'internal error: Unhandled node: ${node.getObjectDescription()}');
}
@@ -79,7 +82,7 @@ abstract class MappingVisitor<T> extends CommonResolverVisitor<T> {
if (element.name == 'yield' ||
element.name == 'async' ||
element.name == 'await') {
- compiler.reportErrorMessage(
+ reporter.reportErrorMessage(
node, MessageKind.ASYNC_KEYWORD_AS_IDENTIFIER,
{'keyword': element.name,
'modifier': currentAsyncMarker});
@@ -90,7 +93,7 @@ abstract class MappingVisitor<T> extends CommonResolverVisitor<T> {
/// Register [node] as the definition of [element].
void defineLocalVariable(Node node, LocalVariableElement element) {
if (element == null) {
- throw compiler.internalError(node, 'element is null');
+ throw reporter.internalError(node, 'element is null');
}
checkLocalDefinitionName(node, element);
registry.defineElement(node, element);
@@ -99,13 +102,13 @@ abstract class MappingVisitor<T> extends CommonResolverVisitor<T> {
void reportDuplicateDefinition(String name,
Spannable definition,
Spannable existing) {
- compiler.reportError(
- compiler.createMessage(
+ reporter.reportError(
+ reporter.createMessage(
definition,
MessageKind.DUPLICATE_DEFINITION,
{'name': name}),
<DiagnosticMessage>[
- compiler.createMessage(
+ reporter.createMessage(
existing,
MessageKind.EXISTING_DEFINITION,
{'name': name}),
« no previous file with comments | « pkg/compiler/lib/src/resolution/resolution.dart ('k') | pkg/compiler/lib/src/resolution/signatures.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698