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

Side by Side Diff: tests/language_strong/bit_shift_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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "package:expect/expect.dart";
6
7 constants() {
8 Expect.equals(0, 499 >> 33);
9 Expect.equals(0, (499 << 33) & 0xFFFFFFFF);
10 }
11
12 foo(i) {
13 if (i != 0) {
14 y--;
15 foo(i - 1);
16 y++;
17 }
18 }
19
20 var y;
21
22 // id returns [x] in a way that should be difficult to predict statically.
23 id(x) {
24 y = x;
25 foo(10);
26 return y;
27 }
28
29 interceptors() {
30 Expect.equals(0, id(499) >> 33);
31 Expect.equals(0, (id(499) << 33) & 0xFFFFFFFF);
32 }
33
34 speculative() {
35 var a = id(499);
36 for (int i = 0; i < 1; i++) {
37 Expect.equals(0, a >> 33);
38 Expect.equals(0, (a << 33) & 0xFFFFFFFF);
39 }
40 }
41
42 // JavaScript shifts by the amount modulo 32. That is x << y is equivalent to
43 // x << (y & 0x1F). Dart does not.
44 main() {
45 constants();
46 interceptors();
47 speculative();
48 }
OLDNEW
« no previous file with comments | « tests/language_strong/bit_operations_test.dart ('k') | tests/language_strong/black_listed_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698