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

Unified Diff: pkg/front_end/lib/src/fasta/type_inference/type_promotion.dart

Issue 2877253003: Don't type promote local functions. (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
Index: pkg/front_end/lib/src/fasta/type_inference/type_promotion.dart
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_promotion.dart b/pkg/front_end/lib/src/fasta/type_inference/type_promotion.dart
index be3152daeccbd69aac8ea8efa5b357c48e85fec3..80229e9c0f6d1324c67e729cacf31626cc8016d6 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_promotion.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_promotion.dart
@@ -198,6 +198,7 @@ abstract class TypePromoterImpl<E, V> extends TypePromoter<E, V> {
void handleIsCheck(E isExpression, bool isInverted, V variable, DartType type,
int functionNestingLevel) {
debugEvent('handleIsCheck');
+ if (!isPromotionCandidate(variable)) return;
var isCheck = new _IsCheck<V>(
++_lastFactSequenceNumber,
variable,
@@ -212,6 +213,14 @@ abstract class TypePromoterImpl<E, V> extends TypePromoter<E, V> {
}
}
+ /// Determines whether the given variable should be considered for promotion
+ /// at all.
+ ///
+ /// This is needed because in kernel, [VariableDeclaration] objects are
+ /// sometimes used to represent local functions, which are not subject to
+ /// promotion.
+ bool isPromotionCandidate(V variable);
+
/// Updates the state to reflect the fact that the given [variable] was
/// mutated.
void mutateVariable(V variable, int functionNestingLevel) {

Powered by Google App Engine
This is Rietveld 408576698