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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart

Issue 2849213002: Add a strong mode implementation of LUB to fasta; use it to infer ?: (Closed)
Patch Set: 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/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index c61fe0bb5a2db33dab7c98bd626c7711a8b17f38..6737745c51dca31d17e7aa2a8df78545dccfe054 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -35,6 +35,21 @@ class KernelBlock extends Block implements KernelStatement {
}
}
+/// Concrete shadow object representing a conditional expression in kernel form.
+class KernelConditionalExpression extends ConditionalExpression
+ implements KernelExpression {
+ KernelConditionalExpression(
+ Expression condition, Expression then, Expression otherwise)
+ : super(condition, then, otherwise, const DynamicType());
+
+ @override
+ DartType _inferExpression(
+ KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
+ return inferrer.inferConditionalExpression(typeContext, typeNeeded,
+ condition, then, otherwise, (type) => staticType = type);
+ }
+}
+
/// Common base class for shadow objects representing expressions in kernel
/// form.
abstract class KernelExpression implements Expression {

Powered by Google App Engine
This is Rietveld 408576698