OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Regression test for dart2js that used to crash when compiling | 5 // Regression test for dart2js that used to crash when compiling |
6 // [foo]. See http://code.google.com/p/dart/issues/detail?id=7448. | 6 // [foo]. See http://code.google.com/p/dart/issues/detail?id=7448. |
7 | 7 |
8 library ports_compilation; | 8 library ports_compilation; |
9 import 'dart:html'; | 9 import 'dart:html'; |
10 import 'dart:isolate'; | 10 import 'dart:isolate'; |
11 import '../../pkg/unittest/lib/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
12 import '../../pkg/unittest/lib/html_config.dart'; | 12 import 'package:unittest/html_config.dart'; |
13 | 13 |
14 void foo() { | 14 void foo() { |
15 // Create a "SendPortSync" object and access one of its members. | 15 // Create a "SendPortSync" object and access one of its members. |
16 SendPortSync s_port; | 16 SendPortSync s_port; |
17 s_port.callSync; | 17 s_port.callSync; |
18 | 18 |
19 // Create a "ReceivePortSync" object (with the constructor) and | 19 // Create a "ReceivePortSync" object (with the constructor) and |
20 // access one of its members. | 20 // access one of its members. |
21 var r_port = new ReceivePortSync(); | 21 var r_port = new ReceivePortSync(); |
22 r_port.receive; | 22 r_port.receive; |
23 | 23 |
24 // Call getComputedStyle() from the HTML library. | 24 // Call getComputedStyle() from the HTML library. |
25 query("").getComputedStyle(""); | 25 query("").getComputedStyle(""); |
26 } | 26 } |
27 | 27 |
28 int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1)); | 28 int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1)); |
29 | 29 |
30 void main() { | 30 void main() { |
31 // Generate the call, but don't execute it. | 31 // Generate the call, but don't execute it. |
32 if (inscrutable(1) != 1) foo(); | 32 if (inscrutable(1) != 1) foo(); |
33 useHtmlConfiguration(); | 33 useHtmlConfiguration(); |
34 bar(); | 34 bar(); |
35 // Also generate it here in case the compiler's worklist goes from | 35 // Also generate it here in case the compiler's worklist goes from |
36 // last seen to first seen. | 36 // last seen to first seen. |
37 if (inscrutable(1) != 1) foo(); | 37 if (inscrutable(1) != 1) foo(); |
38 } | 38 } |
39 | 39 |
40 bar() { | 40 bar() { |
41 test('compile', () { }); | 41 test('compile', () { }); |
42 } | 42 } |
OLD | NEW |