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

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

Issue 2981693002: Start copying resolution/inference data from front end to analyzer ASTs. (Closed)
Patch Set: Address code review comments. Created 3 years, 5 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 3a570eaa575577246e5c043022448a1e072284d9..4ed376eba7b086c3a183cacac41a752504c116c0 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -418,8 +418,8 @@ class DietListener extends StackListener {
StackListener createListener(
ModifierBuilder builder, Scope memberScope, bool isInstanceMember,
- [Scope formalParameterScope]) {
- var listener = new TypeInferenceListener();
+ [Scope formalParameterScope, TypeInferenceListener listener]) {
+ listener ??= new TypeInferenceListener();
InterfaceType thisType;
if (builder.isClassMember) {
// Note: we set thisType regardless of whether we are building a static
@@ -537,8 +537,25 @@ class DietListener extends StackListener {
AsyncMarker getAsyncMarker(StackListener listener) => listener.pop();
- void parseFunctionBody(
- StackListener listener, Token token, Token metadata, MemberKind kind) {
+ /// Invokes the listener's [finishFunction] method.
+ ///
+ /// This is a separate method so that it may be overridden by a derived class
+ /// if more computation must be done before finishing the function.
+ void listenerFinishFunction(
+ StackListener listener,
+ Token token,
+ Token metadata,
+ MemberKind kind,
+ List metadataConstants,
+ dynamic formals,
+ AsyncMarker asyncModifier,
+ dynamic body) {
+ listener.finishFunction(metadataConstants, formals, asyncModifier, body);
+ }
+
+ void parseFunctionBody(StackListener listener, Token startToken,
+ Token metadata, MemberKind kind) {
+ Token token = startToken;
try {
Parser parser = new Parser(listener);
List metadataConstants;
@@ -557,7 +574,8 @@ class DietListener extends StackListener {
parser.parseFunctionBody(token, isExpression, allowAbstract);
var body = listener.pop();
listener.checkEmpty(token.charOffset);
- listener.finishFunction(metadataConstants, formals, asyncModifier, body);
+ listenerFinishFunction(listener, startToken, metadata, kind,
+ metadataConstants, formals, asyncModifier, body);
} on deprecated_InputError {
rethrow;
} catch (e, s) {

Powered by Google App Engine
This is Rietveld 408576698