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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 2846463003: Instrument analyzer's type analysis and run front_end inference tests. (Closed)
Patch Set: Updates. Created 3 years, 8 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/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 74232cdf993c07d51b10b7be7e677f908db92be6..4170c00569eabdebaf09c571bbf714692674bc0f 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -24,6 +24,7 @@ import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/dart/resolver/inheritance_manager.dart';
import 'package:analyzer/src/dart/resolver/scope.dart';
import 'package:analyzer/src/error/codes.dart';
+import 'package:analyzer/src/fasta/uri_instrumentation.dart';
import 'package:analyzer/src/generated/constant.dart';
import 'package:analyzer/src/generated/element_resolver.dart';
import 'package:analyzer/src/generated/engine.dart';
@@ -4211,6 +4212,11 @@ class InferenceContext {
final ErrorReporter _errorReporter;
/**
+ * The instrumentation to report inference information.
+ */
+ final UriInstrumentation _instrumentation;
+
+ /**
* If true, emit hints when types are inferred
*/
final bool _inferenceHints;
@@ -4239,8 +4245,8 @@ class InferenceContext {
*/
final List<DartType> _returnStack = <DartType>[];
- InferenceContext._(this._errorReporter, TypeProvider typeProvider,
- this._typeSystem, this._inferenceHints)
+ InferenceContext._(TypeProvider typeProvider, this._typeSystem,
+ this._inferenceHints, this._errorReporter, this._instrumentation)
: _typeProvider = typeProvider;
/**
@@ -4304,6 +4310,8 @@ class InferenceContext {
* [type] has been inferred as the type of [node].
*/
void recordInference(Expression node, DartType type) {
+ _instrumentation?.recordInference(node.offset, type);
+
if (!_inferenceHints) {
return;
}
@@ -4992,6 +5000,11 @@ class ResolverVisitor extends ScopedVisitor {
TypeSystem typeSystem;
/**
+ * The instrumentation to report inference information.
+ */
+ final UriInstrumentation instrumentation;
+
+ /**
* The class declaration representing the class containing the current node, or `null` if
* the current node is not contained in a class.
*/
@@ -5060,7 +5073,7 @@ class ResolverVisitor extends ScopedVisitor {
*/
ResolverVisitor(LibraryElement definingLibrary, Source source,
TypeProvider typeProvider, AnalysisErrorListener errorListener,
- {Scope nameScope})
+ {Scope nameScope, this.instrumentation})
: super(definingLibrary, source, typeProvider, errorListener,
nameScope: nameScope) {
AnalysisOptions options = definingLibrary.context.analysisOptions;
@@ -5071,8 +5084,8 @@ class ResolverVisitor extends ScopedVisitor {
if (options is AnalysisOptionsImpl) {
strongModeHints = options.strongModeHints;
}
- this.inferenceContext = new InferenceContext._(
- errorReporter, typeProvider, typeSystem, strongModeHints);
+ this.inferenceContext = new InferenceContext._(typeProvider, typeSystem,
+ strongModeHints, errorReporter, instrumentation);
this.typeAnalyzer = new StaticTypeAnalyzer(this);
}
« no previous file with comments | « pkg/analyzer/lib/src/fasta/uri_instrumentation.dart ('k') | pkg/analyzer/lib/src/generated/static_type_analyzer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698