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

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

Issue 2959763002: Add type inference for assert statements. (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
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 ff7b30d7c1d1579daf2c1652d5f22d9c91600958..1e4e93f28827bc67c45af9eaac4260a33acbb1a1 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
@@ -90,6 +90,26 @@ class KernelAsExpression extends AsExpression implements KernelExpression {
}
}
+/// Concrete shadow object representing an assertion statement in kernel form.
+class KernelAssertStatement extends AssertStatement implements KernelStatement {
+ KernelAssertStatement(Expression condition,
+ {Expression message, int conditionStartOffset, int conditionEndOffset})
+ : super(condition,
+ message: message,
+ conditionStartOffset: conditionStartOffset,
+ conditionEndOffset: conditionEndOffset);
+
+ @override
+ void _inferStatement(KernelTypeInferrer inferrer) {
+ inferrer.listener.assertStatementEnter(this);
+ inferrer.inferExpression(condition, null, false);
+ if (message != null) {
+ inferrer.inferExpression(message, null, false);
+ }
+ inferrer.listener.assertStatementExit(this);
+ }
+}
+
/// Shadow object for [AwaitExpression].
class KernelAwaitExpression extends AwaitExpression
implements KernelExpression {

Powered by Google App Engine
This is Rietveld 408576698