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

Unified Diff: pkg/analyzer/test/src/task/strong/front_end_inference_test.dart

Issue 2868133002: Fix annotation of promoted parameters in Fasta inference tests. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | pkg/front_end/test/fasta/strong.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart b/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
index da2410cf4b94d2816d4e3e996952fb7e19e0792f..34abf39f1448a759231453a3097c419af93e819f 100644
--- a/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
+++ b/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
@@ -276,17 +276,25 @@ class _InstrumentationVisitor extends RecursiveAstVisitor<Null> {
visitSimpleIdentifier(SimpleIdentifier node) {
super.visitSimpleIdentifier(node);
Element element = node.staticElement;
- if (element is LocalVariableElement && node.inGetterContext()) {
- int offset = node.offset;
- DartType type = node.staticType;
- if (identical(type, element.type)) {
- _instrumentation.record(uri, offset, 'promotedType',
- const fasta.InstrumentationValueLiteral('none'));
- } else {
- _instrumentation.record(uri, offset, 'promotedType',
- new _InstrumentationValueForType(type));
+ void recordPromotions(DartType elementType) {
+ if (node.inGetterContext() && !node.inDeclarationContext()) {
+ int offset = node.offset;
+ DartType type = node.staticType;
+ if (identical(type, elementType)) {
+ _instrumentation.record(uri, offset, 'promotedType',
+ const fasta.InstrumentationValueLiteral('none'));
+ } else {
+ _instrumentation.record(uri, offset, 'promotedType',
+ new _InstrumentationValueForType(type));
+ }
}
}
+
+ if (element is LocalVariableElement) {
+ recordPromotions(element.type);
+ } else if (element is ParameterElement) {
+ recordPromotions(element.type);
+ }
}
visitVariableDeclarationList(VariableDeclarationList node) {
« no previous file with comments | « no previous file | pkg/front_end/test/fasta/strong.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698