Remove UnhandledListener
Change-Id: I693f3352a3e5582456b4f41c9b7dc06d23cf98d3
Reviewed-on: https://dart-review.googlesource.com/56327
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
diff --git a/pkg/front_end/lib/src/fasta/builder/builder.dart b/pkg/front_end/lib/src/fasta/builder/builder.dart
index 9a49fd8..65fc3cd 100644
--- a/pkg/front_end/lib/src/fasta/builder/builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/builder.dart
@@ -14,8 +14,6 @@
export '../scope.dart' show AccessErrorBuilder, Scope, ScopeBuilder;
-export '../source/unhandled_listener.dart' show Unhandled;
-
export 'builtin_type_builder.dart' show BuiltinTypeBuilder;
export 'class_builder.dart' show ClassBuilder;
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index d45dd99..40e2540 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -312,10 +312,6 @@
Statement popStatement() => forest.wrapVariables(pop());
- void ignore(Unhandled value) {
- pop();
- }
-
void enterSwitchScope() {
push(switchScope ?? NullValue.SwitchScope);
switchScope = scope;
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
index 1a2fa07..8244fca 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -62,7 +62,7 @@
import 'source_library_builder.dart' show SourceLibraryBuilder;
-import 'unhandled_listener.dart' show NullValue, UnhandledListener;
+import 'stack_listener.dart' show NullValue, StackListener;
import '../configuration.dart' show Configuration;
@@ -72,7 +72,7 @@
RedirectingFactoryBody,
}
-class OutlineBuilder extends UnhandledListener {
+class OutlineBuilder extends StackListener {
final SourceLibraryBuilder library;
final bool enableNative;
@@ -90,7 +90,6 @@
@override
Uri get uri => library.fileUri;
- @override
int popCharOffset() => pop();
List<String> popIdentifierList(int count) {
diff --git a/pkg/front_end/lib/src/fasta/source/scope_listener.dart b/pkg/front_end/lib/src/fasta/source/scope_listener.dart
index 5bb4fa0..e9a61e3 100644
--- a/pkg/front_end/lib/src/fasta/source/scope_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/scope_listener.dart
@@ -6,11 +6,11 @@
import '../../scanner/token.dart' show Token;
-import 'unhandled_listener.dart' show NullValue, UnhandledListener;
-
import '../scope.dart' show Scope;
-export 'unhandled_listener.dart' show NullValue, Unhandled;
+import 'stack_listener.dart' show NullValue, StackListener;
+
+export 'stack_listener.dart' show NullValue;
enum JumpTargetKind {
Break,
@@ -18,7 +18,7 @@
Goto, // Continue label in switch.
}
-abstract class ScopeListener<J> extends UnhandledListener {
+abstract class ScopeListener<J> extends StackListener {
Scope scope;
J breakTarget;
diff --git a/pkg/front_end/lib/src/fasta/source/unhandled_listener.dart b/pkg/front_end/lib/src/fasta/source/unhandled_listener.dart
deleted file mode 100644
index c678a477..0000000
--- a/pkg/front_end/lib/src/fasta/source/unhandled_listener.dart
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library fasta.unhandled_listener;
-
-import '../../scanner/token.dart' show Token;
-
-import 'stack_listener.dart' show NullValue, StackListener;
-
-export 'stack_listener.dart' show NullValue;
-
-// TODO(ahe): Get rid of this.
-enum Unhandled {
- ConditionalUri,
- ConditionalUris,
- DottedName,
- Hide,
- Initializers,
- Interpolation,
- Metadata,
- Show,
- TypeVariables,
-}
-
-// TODO(ahe): Get rid of this class when all listeners are complete.
-abstract class UnhandledListener extends StackListener {
- int popCharOffset() => -1;
-
- List<String> popIdentifierList(int count) => popList(count);
-
- @override
- void endConditionalUri(Token ifKeyword, Token leftParen, Token equalSign) {
- debugEvent("ConditionalUri");
- popCharOffset();
- pop(); // URI.
- if (equalSign != null) popCharOffset();
- popIfNotNull(equalSign); // String.
- pop(); // DottedName.
- push(Unhandled.ConditionalUri);
- }
-
- @override
- void endConditionalUris(int count) {
- debugEvent("ConditionalUris");
- popList(count);
- push(Unhandled.ConditionalUris);
- }
-
- @override
- void endHide(Token hideKeyword) {
- debugEvent("Hide");
- pop();
- push(Unhandled.Hide);
- }
-
- @override
- void endShow(Token showKeyword) {
- debugEvent("Show");
- pop();
- push(Unhandled.Show);
- }
-
- @override
- void endCombinators(int count) {
- debugEvent("Combinators");
- push(popList(count) ?? NullValue.Combinators);
- }
-
- @override
- void handleDottedName(int count, Token firstIdentifier) {
- debugEvent("DottedName");
- popIdentifierList(count);
- push(Unhandled.DottedName);
- }
-
- @override
- void endFunctionType(Token functionToken, Token endToken) {
- pop(); // Formals.
- pop(); // Return type.
- pop(); // Type variables.
- push(NullValue.Type);
- }
-}