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

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

Issue 2962913002: Create an option to disable type inference and type promotion. (Closed)
Patch Set: Created 3 years, 6 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 | « pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart ('k') | pkg/kernel/lib/target/targets.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8fccb03919a03e76bedd8ed55fa4b8692c2a33cb..94ab897e1293acb409e71db71295ad6daad4a107 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
@@ -72,6 +72,44 @@ abstract class TypePromoter {
void mutateVariable(VariableDeclaration variable, int functionNestingLevel);
}
+/// Implementation of [TypePromoter] which doesn't do any type promotion.
+///
+/// This is intended for profiling, to ensure that type inference and type
+/// promotion do not slow down compilation too much.
+class TypePromoterDisabled extends TypePromoter {
+ @override
+ TypePromotionScope get currentScope => null;
+
+ @override
+ DartType computePromotedType(TypePromotionFact fact, TypePromotionScope scope,
+ bool mutatedInClosure) =>
+ null;
+
+ @override
+ void enterElse() {}
+
+ @override
+ void enterThen(Expression condition) {}
+
+ @override
+ void exitConditional() {}
+
+ @override
+ void finished() {}
+
+ @override
+ TypePromotionFact getFactForAccess(
+ VariableDeclaration variable, int functionNestingLevel) =>
+ null;
+
+ @override
+ void handleIsCheck(Expression isExpression, bool isInverted,
+ VariableDeclaration variable, DartType type, int functionNestingLevel) {}
+
+ @override
+ void mutateVariable(VariableDeclaration variable, int functionNestingLevel) {}
+}
+
/// Derived class containing generic implementations of [TypePromoter].
///
/// This class contains as much of the implementation of type promotion as
« no previous file with comments | « pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart ('k') | pkg/kernel/lib/target/targets.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698