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

Unified Diff: pkg/analyzer2dart/test/end2end_test.dart

Issue 669693002: Support unreachable code in blocks in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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/analyzer2dart/test/end2end_test.dart
diff --git a/pkg/analyzer2dart/test/end2end_test.dart b/pkg/analyzer2dart/test/end2end_test.dart
index 8bdbfffaa2e3b25770a38453e02c4a22054ecc39..64f83a0d4ef566ce1643ca37e3f2ce73345cc0a9 100644
--- a/pkg/analyzer2dart/test/end2end_test.dart
+++ b/pkg/analyzer2dart/test/end2end_test.dart
@@ -486,7 +486,7 @@ main(a) {
''');
});
- test('If statement', () {
+ test('Conditional expression', () {
checkResult('''
main(a) {
return a ? print(0) : print(1);
@@ -497,6 +497,59 @@ main(a) {
}
''');
});
+
sigurdm 2014/10/21 08:22:44 Maybe it would be beneficial to add a comment to e
Johnni Winther 2014/10/23 06:55:12 Done.
+ test('Block statements', () {
+ checkResult('''
+main(a) {
+ return 0;
+ return 1;
+}
+''', '''
+main(a) {
+ return 0;
+}
+''');
+
+ checkResult('''
+main(a) {
+ if (a) {
+ return 0;
+ return 1;
+ } else {
+ return 2;
+ return 3;
+ }
+}
+''', '''
+main(a) {
+ return a ? 0 : 2;
+}
+''');
+
+ checkResult('''
+main(a) {
+ if (a) {
+ print(0);
+ return 0;
+ return 1;
+ } else {
+ print(2);
+ return 2;
+ return 3;
+ }
+}
+''', '''
+main(a) {
+ if (a) {
+ print(0);
+ return 0;
+ } else {
+ print(2);
+ return 2;
+ }
+}
+''');
+ });
}
checkResult(String input, [String expectedOutput]) {
« no previous file with comments | « pkg/analyzer2dart/lib/src/cps_generator.dart ('k') | sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698