| OLD | NEW |
| 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_printer_test; | 5 library dart_printer_test; |
| 6 | 6 |
| 7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
| 8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
| 9 import 'package:compiler/src/constants/values.dart'; | 9 import 'package:compiler/src/constants/values.dart'; |
| 10 import 'package:compiler/src/dart_backend/backend_ast_nodes.dart'; | 10 import 'package:compiler/src/dart_backend/backend_ast_nodes.dart'; |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 push(null); | 576 push(null); |
| 577 } | 577 } |
| 578 | 578 |
| 579 endForIn(Token await, Token begin, Token inKeyword, Token end) { | 579 endForIn(Token await, Token begin, Token inKeyword, Token end) { |
| 580 Statement body = pop(); | 580 Statement body = pop(); |
| 581 Expression exp = pop(); | 581 Expression exp = pop(); |
| 582 Node declaredIdentifier = pop(); | 582 Node declaredIdentifier = pop(); |
| 583 push(new ForIn(declaredIdentifier, exp, body)); | 583 push(new ForIn(declaredIdentifier, exp, body)); |
| 584 } | 584 } |
| 585 | 585 |
| 586 handleAssertStatement(Token assertKeyword, Token semicolonToken) { | 586 handleAssertStatement(Token assertKeyword, |
| 587 Token commaToken, Token semicolonToken) { |
| 588 Expression message; |
| 589 if (commaToken != null) message = pop(); |
| 587 Expression exp = pop(); | 590 Expression exp = pop(); |
| 588 Expression call = new CallFunction(new Identifier("assert"), [exp]); | 591 var arguments = [exp]; |
| 592 if (message != null) arguments.add(message); |
| 593 Expression call = new CallFunction(new Identifier("assert"), arguments); |
| 589 push(new ExpressionStatement(call)); | 594 push(new ExpressionStatement(call)); |
| 590 } | 595 } |
| 591 | 596 |
| 592 endLabeledStatement(int labelCount) { | 597 endLabeledStatement(int labelCount) { |
| 593 Statement statement = pop(); | 598 Statement statement = pop(); |
| 594 for (int i=0; i<labelCount; i++) { | 599 for (int i=0; i<labelCount; i++) { |
| 595 String label = pop(asName); | 600 String label = pop(asName); |
| 596 statement = new LabeledStatement(label, statement); | 601 statement = new LabeledStatement(label, statement); |
| 597 } | 602 } |
| 598 push(statement); | 603 push(statement); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 checkStatement("do while(x); while (y);"); | 975 checkStatement("do while(x); while (y);"); |
| 971 checkStatement("{do; while(x); while (y);}"); | 976 checkStatement("{do; while(x); while (y);}"); |
| 972 | 977 |
| 973 checkStatement('switch(x) { case 1: case 2: return y; }'); | 978 checkStatement('switch(x) { case 1: case 2: return y; }'); |
| 974 checkStatement('switch(x) { default: return y; }'); | 979 checkStatement('switch(x) { default: return y; }'); |
| 975 checkStatement('switch(x) { case 1: x=y; default: return y; }'); | 980 checkStatement('switch(x) { case 1: x=y; default: return y; }'); |
| 976 checkStatement('switch(x) { case 1: x=y; y=z; break; default: return y; }'); | 981 checkStatement('switch(x) { case 1: x=y; y=z; break; default: return y; }'); |
| 977 | 982 |
| 978 } | 983 } |
| 979 | 984 |
| OLD | NEW |