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

Unified Diff: pkg/analyzer/lib/src/fasta/resolution_storer.dart

Issue 2980053002: Further integration of front end type inference into analyzer. (Closed)
Patch Set: 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/analyzer/lib/src/fasta/resolution_storer.dart
diff --git a/pkg/analyzer/lib/src/fasta/resolution_storer.dart b/pkg/analyzer/lib/src/fasta/resolution_storer.dart
index 7ea096a3b1f4885ce2d574b1b1e34c59047537ea..69d021c199dadd4a4319dde10eaca3e692eead0e 100644
--- a/pkg/analyzer/lib/src/fasta/resolution_storer.dart
+++ b/pkg/analyzer/lib/src/fasta/resolution_storer.dart
@@ -14,11 +14,10 @@ class InstrumentedResolutionStorer extends ResolutionStorer {
: super(types);
@override
- void genericExpressionExit(
- String expressionType, Expression expression, DartType inferredType) {
+ void _recordType(DartType type, int offset) {
assert(_types.length == _typeOffsets.length);
- this._typeOffsets.add(expression.fileOffset);
- super.genericExpressionExit(expressionType, expression, inferredType);
+ _typeOffsets.add(offset);
+ super._recordType(type, offset);
}
}
@@ -39,7 +38,17 @@ class ResolutionStorer extends TypeInferenceListener {
@override
void genericExpressionExit(
String expressionType, Expression expression, DartType inferredType) {
- _types.add(inferredType);
+ _recordType(inferredType, expression.fileOffset);
super.genericExpressionExit(expressionType, expression, inferredType);
}
+
+ @override
+ void variableDeclarationEnter(VariableDeclaration statement) {
+ _recordType(statement.type, statement.fileOffset);
+ super.variableDeclarationEnter(statement);
+ }
+
+ void _recordType(DartType type, int offset) {
+ _types.add(type);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698