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

Side by Side Diff: tests/language_strong/bailout5_test.dart

Issue 2990933002: Migrate block 43. (Closed)
Patch Set: Update tests and status file. Created 3 years, 4 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
« no previous file with comments | « tests/language_strong/bailout4_test.dart ('k') | tests/language_strong/bailout6_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
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4
5 import "package:expect/expect.dart";
6
7 // Test to make sure the bailout environment in dart2js is correct.
8
9 var global;
10
11 class A {
12 var array;
13
14 initArray() {
15 return global[0] == null ? [null] : new Map();
16 }
17
18 bar() {
19 array = initArray();
20 do {
21 var element = array[0]; // bailout here
22 if (element is Map) continue;
23 if (element == null) break;
24 } while (true);
25 return global[0]; // bailout here
26 }
27
28 baz() {
29 do {
30 var element = bar();
31 if (element == null) return global[0]; // bailout here
32 if (element is Map) continue;
33 if (element is num) break;
34 } while (true);
35 return global[0]; // bailout here
36 }
37 }
38
39 void main() {
40 global = [1];
41 for (int i = 0; i < 2; i++) {
42 Expect.equals(1, new A().baz());
43 Expect.equals(1, new A().bar());
44 }
45 global = new Map();
46 for (int i = 0; i < 2; i++) {
47 Expect.equals(null, new A().baz());
48 Expect.equals(null, new A().bar());
49 }
50
51 global[0] = 42;
52 for (int i = 0; i < 2; i++) {
53 Expect.equals(42, new A().baz());
54 Expect.equals(42, new A().bar());
55 }
56 }
OLDNEW
« no previous file with comments | « tests/language_strong/bailout4_test.dart ('k') | tests/language_strong/bailout6_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698