OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 constants() { | 5 constants() { |
6 Expect.equals(0x80000000, 0x80000000 | 0); | 6 Expect.equals(0x80000000, 0x80000000 | 0); |
7 Expect.equals(0x80000001, 0x80000000 | 1); | 7 Expect.equals(0x80000001, 0x80000000 | 1); |
8 Expect.equals(0x80000000, 0x80000000 | 0x80000000); | 8 Expect.equals(0x80000000, 0x80000000 | 0x80000000); |
9 Expect.equals(0xFFFFFFFF, 0xFFFF0000 | 0xFFFF); | 9 Expect.equals(0xFFFFFFFF, 0xFFFF0000 | 0xFFFF); |
10 Expect.equals(0x80000000, 0x80000000 & 0xFFFFFFFF); | 10 Expect.equals(0x80000000, 0x80000000 & 0xFFFFFFFF); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 Expect.equals(0xFFFFFFFC, | 101 Expect.equals(0xFFFFFFFC, |
102 ((((((m << 4) // 0xFFFFFFF0 | 102 ((((((m << 4) // 0xFFFFFFF0 |
103 >> 1) // 0x7FFFFFF8 | 103 >> 1) // 0x7FFFFFF8 |
104 | 0x80000000) // 0xFFFFFFF8 | 104 | 0x80000000) // 0xFFFFFFF8 |
105 >> 2) // 0x3FFFFFFE | 105 >> 2) // 0x3FFFFFFE |
106 ^ 0x40000000) // 0x7FFFFFFE | 106 ^ 0x40000000) // 0x7FFFFFFE |
107 << 1)); | 107 << 1)); |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
| 111 // Due to bad precedence rules this example was broken in Dart2Js. |
| 112 precedence() { |
| 113 Expect.equals(0x80000000, -1 & 0x80000000); |
| 114 Expect.equals(0x80000000, id(-1) & 0x80000000); |
| 115 Expect.equals(0x80000000, ~(~(0x80000000))); |
| 116 Expect.equals(0x80000000, ~(~(id(0x80000000)))); |
| 117 } |
| 118 |
111 main() { | 119 main() { |
112 constants(); | 120 constants(); |
113 interceptors(); | 121 interceptors(); |
114 speculative(); | 122 speculative(); |
| 123 precedence(); |
115 } | 124 } |
OLD | NEW |