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

Unified Diff: frog/leg/ssa/builder.dart

Issue 9657003: Support for loops without conditions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 | « no previous file | tests/language/src/ForWithoutConditionTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/ssa/builder.dart
===================================================================
--- frog/leg/ssa/builder.dart (revision 5192)
+++ frog/leg/ssa/builder.dart (working copy)
@@ -1053,9 +1053,9 @@
// <updates>
// goto loop-entry;
// loop-exit:
- if (condition === null || body === null) {
+ if (body === null) {
compiler.unimplemented(
- 'SsaBuilder.visitLoop with empty condition or body',
+ 'SsaBuilder.visitLoop with empty body',
node: loop);
}
@@ -1072,9 +1072,13 @@
BreakHandler breakHandler = beginLoopHeader(loop);
HBasicBlock conditionBlock = current;
- // The condition.
- visit(condition);
- HBasicBlock conditionExitBlock = close(new HLoopBranch(popBoolified()));
+ HBasicBlock conditionExitBlock;
+ if (condition != null) {
+ visit(condition);
+ conditionExitBlock = close(new HLoopBranch(popBoolified()));
+ } else {
+ conditionExitBlock = close(new HLoopBranch(graph.addConstantBool(true)));
Lasse Reichstein Nielsen 2012/03/09 07:16:46 This could be one line with a conditional expressi
ngeoffray 2012/03/09 09:16:45 Done.
+ }
LocalsHandler savedLocals = new LocalsHandler.from(localsHandler);
@@ -1119,9 +1123,6 @@
}
visitFor(For node) {
- if (node.condition === null) {
- compiler.unimplemented("SsaBuilder for loop without condition");
- }
assert(node.body !== null);
visitLoop(node, node.initializer, node.condition, node.update, node.body);
}
« no previous file with comments | « no previous file | tests/language/src/ForWithoutConditionTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698