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

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

Issue 2951033004: Implement type inference for conventional for-loops. (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 c7b4bce4de4bccf46e074ca3f043787a7e098aac..3e07b29ab74e558b26a7aa99c5954baca193d643 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
@@ -709,6 +709,26 @@ class KernelForInStatement extends ForInStatement implements KernelStatement {
}
}
+/// Concrete shadow object representing a classic for loop in kernel form.
+class KernelForStatement extends ForStatement implements KernelStatement {
+ KernelForStatement(List<VariableDeclaration> variables, Expression condition,
+ List<Expression> updates, Statement body)
+ : super(variables, condition, updates, body);
+
+ @override
+ void _inferStatement(KernelTypeInferrer inferrer) {
+ inferrer.listener.forStatementEnter(this);
+ variables.forEach(inferrer.inferStatement);
+ inferrer.inferExpression(
+ condition, inferrer.coreTypes.boolClass.rawType, false);
+ for (var update in updates) {
+ inferrer.inferExpression(update, null, false);
+ }
+ inferrer.inferStatement(body);
+ inferrer.listener.forStatementExit(this);
+ }
+}
+
/// Concrete shadow object representing a local function declaration in kernel
/// form.
class KernelFunctionDeclaration extends FunctionDeclaration

Powered by Google App Engine
This is Rietveld 408576698