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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart_backend/dart_codegen.dart

Issue 294163011: dart2dart: Fix fallthrough in while statements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: SVN rebase Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/rewrite_while_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart_codegen; 5 library dart_codegen;
6 6
7 import 'dart_tree.dart' as tree; 7 import 'dart_tree.dart' as tree;
8 import 'dart_printer.dart'; 8 import 'dart_printer.dart';
9 import 'dart_tree_printer.dart' show TreePrinter; 9 import 'dart_tree_printer.dart' show TreePrinter;
10 import '../tree/tree.dart' as frontend; 10 import '../tree/tree.dart' as frontend;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 visitStatement(stmt.elseStatement); 183 visitStatement(stmt.elseStatement);
184 savedBuffer.add( 184 savedBuffer.add(
185 new If(condition, new Block(thenBuffer), new Block(elseBuffer))); 185 new If(condition, new Block(thenBuffer), new Block(elseBuffer)));
186 statementBuffer = savedBuffer; 186 statementBuffer = savedBuffer;
187 } 187 }
188 188
189 void visitWhile(tree.While stmt) { 189 void visitWhile(tree.While stmt) {
190 Expression condition = new Literal(new dart2js.BoolConstant(true)); 190 Expression condition = new Literal(new dart2js.BoolConstant(true));
191 List<Statement> savedBuffer = statementBuffer; 191 List<Statement> savedBuffer = statementBuffer;
192 statementBuffer = <Statement>[]; 192 statementBuffer = <Statement>[];
193 tree.Statement savedFallthrough = fallthrough;
194 fallthrough = stmt.body;
193 visitStatement(stmt.body); 195 visitStatement(stmt.body);
194 savedBuffer.add( 196 savedBuffer.add(
195 new LabeledStatement( 197 new LabeledStatement(
196 stmt.label.name, 198 stmt.label.name,
197 new While(condition, new Block(statementBuffer)))); 199 new While(condition, new Block(statementBuffer))));
198 statementBuffer = savedBuffer; 200 statementBuffer = savedBuffer;
201 fallthrough = savedFallthrough;
199 } 202 }
200 203
201 Expression visitConstant(tree.Constant exp) { 204 Expression visitConstant(tree.Constant exp) {
202 return emitConstant(exp.value); 205 return emitConstant(exp.value);
203 } 206 }
204 207
205 Expression visitLiteralList(tree.LiteralList exp) { 208 Expression visitLiteralList(tree.LiteralList exp) {
206 return new LiteralList( 209 return new LiteralList(
207 exp.values.map(visitExpression).toList(growable: false)); 210 exp.values.map(visitExpression).toList(growable: false));
208 } 211 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 emitConstant(constant.keys.entries[i]), 354 emitConstant(constant.keys.entries[i]),
352 emitConstant(constant.values[i]))); 355 emitConstant(constant.values[i])));
353 } 356 }
354 return new LiteralMap(entries, isConst: true); 357 return new LiteralMap(entries, isConst: true);
355 } else { 358 } else {
356 throw "Unsupported constant: $constant"; 359 throw "Unsupported constant: $constant";
357 } 360 }
358 } 361 }
359 } 362 }
360 363
OLDNEW
« no previous file with comments | « no previous file | tests/language/rewrite_while_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698