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

Side by Side Diff: pkg/analyzer/lib/src/fasta/resolution_storer.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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:front_end/src/fasta/type_inference/type_inference_listener.dart' ;
6 import 'package:kernel/ast.dart';
7
8 /// Type inference listener that records inferred types and file offsets for
9 /// later use by [ValidatingResolutionApplier].
10 class InstrumentedResolutionStorer extends ResolutionStorer {
11 final List<int> _typeOffsets;
12
13 InstrumentedResolutionStorer(List<DartType> types, this._typeOffsets)
14 : super(types);
15
16 @override
17 void genericExpressionExit(
18 String expressionType, Expression expression, DartType inferredType) {
19 assert(_types.length == _typeOffsets.length);
20 this._typeOffsets.add(expression.fileOffset);
21 super.genericExpressionExit(expressionType, expression, inferredType);
22 }
23 }
24
25 /// Type inference listener that records inferred types for later use by
26 /// [ResolutionApplier].
27 class ResolutionStorer extends TypeInferenceListener {
28 final List<DartType> _types;
29
30 ResolutionStorer(this._types);
31
32 @override
33 bool genericExpressionEnter(
34 String expressionType, Expression expression, DartType typeContext) {
35 super.genericExpressionEnter(expressionType, expression, typeContext);
36 return true;
37 }
38
39 @override
40 void genericExpressionExit(
41 String expressionType, Expression expression, DartType inferredType) {
42 _types.add(inferredType);
43 super.genericExpressionExit(expressionType, expression, inferredType);
44 }
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698