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

Unified Diff: pkg/front_end/lib/src/fasta/source/diet_listener.dart

Issue 2723113002: Consolidate analyzer dependencies. (Closed)
Patch Set: Remove new dependency on AsyncMarker. Created 3 years, 10 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/front_end/lib/src/fasta/source/diet_listener.dart
diff --git a/pkg/front_end/lib/src/fasta/source/diet_listener.dart b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
index 8f51cfdae72f675cee3c8a6e343fe927fde2ffb1..89cbf4a5ce129a2c37669e2912486ede133098d5 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -29,12 +29,8 @@ import '../kernel/body_builder.dart' show BodyBuilder;
import '../builder/builder.dart';
-import '../analyzer/analyzer.dart';
-
import '../builder/scope.dart' show Scope;
-import '../ast_kind.dart' show AstKind;
-
import 'source_library_builder.dart' show SourceLibraryBuilder;
import '../kernel/kernel_library_builder.dart' show isConstructorName;
@@ -42,14 +38,10 @@ import '../kernel/kernel_library_builder.dart' show isConstructorName;
class DietListener extends StackListener {
final SourceLibraryBuilder library;
- final ElementStore elementStore;
-
final ClassHierarchy hierarchy;
final CoreTypes coreTypes;
- final AstKind astKind;
-
final bool isDartLibrary;
ClassBuilder currentClass;
@@ -61,8 +53,7 @@ class DietListener extends StackListener {
@override
Uri uri;
- DietListener(SourceLibraryBuilder library, this.elementStore, this.hierarchy,
- this.coreTypes, this.astKind)
+ DietListener(SourceLibraryBuilder library, this.hierarchy, this.coreTypes)
: library = library,
uri = library.fileUri,
memberScope = library.scope,
@@ -380,24 +371,8 @@ class DietListener extends StackListener {
StackListener createListener(
MemberBuilder builder, Scope memberScope, bool isInstanceMember,
[Scope formalParameterScope]) {
- switch (astKind) {
- case AstKind.Kernel:
- return new BodyBuilder(
- library,
- builder,
- memberScope,
- formalParameterScope,
- hierarchy,
- coreTypes,
- currentClass,
- isInstanceMember,
- uri);
-
- case AstKind.Analyzer:
- return new AstBuilder(library, builder, elementStore, memberScope, uri);
- }
-
- return internalError("Unknown $astKind");
+ return new BodyBuilder(library, builder, memberScope, formalParameterScope,
+ hierarchy, coreTypes, currentClass, isInstanceMember, uri);
}
void buildFunctionBody(Token token, ProcedureBuilder builder) {
@@ -487,6 +462,8 @@ class DietListener extends StackListener {
return removeNativeClause(identifiers);
}
+ AsyncMarker getAsyncMarker(StackListener listener) => listener.pop();
+
void parseFunctionBody(StackListener listener, Token token) {
try {
Parser parser = new Parser(listener);
@@ -496,8 +473,7 @@ class DietListener extends StackListener {
listener.prepareInitializers();
token = parser.parseInitializersOpt(token);
token = parser.parseAsyncModifier(token);
- AsyncMarker asyncModifier =
- astKind == AstKind.Analyzer ? null : listener.pop();
+ AsyncMarker asyncModifier = getAsyncMarker(listener);
bool isExpression = false;
bool allowAbstract = true;
parser.parseFunctionBody(token, isExpression, allowAbstract);
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/keyword.dart ('k') | pkg/front_end/lib/src/fasta/source/source_loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698