OLD | NEW |
---|---|
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // VMOptions= | 4 // VMOptions= |
5 // VMOptions=--compile_all | 5 // VMOptions=--compile_all |
6 | 6 |
7 // Exercises language constructs that require compile time constants | 7 // Exercises language constructs that require compile time constants |
8 | 8 |
9 // Initialize with different literal types | 9 // Initialize with different literal types |
10 const b = true; | 10 const b = true; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 const BOP5_0 = 0x80 & 0x04; | 61 const BOP5_0 = 0x80 & 0x04; |
62 const BOP5_1 = 0x80 | 0x04; | 62 const BOP5_1 = 0x80 | 0x04; |
63 const BOP5_2 = 0x80 << 0x04; | 63 const BOP5_2 = 0x80 << 0x04; |
64 const BOP5_3 = 0x80 >> 0x04; | 64 const BOP5_3 = 0x80 >> 0x04; |
65 const BOP5_4 = 0x80 ~/ 0x04; | 65 const BOP5_4 = 0x80 ~/ 0x04; |
66 const BOP5_5 = 0x80 ^ 0x04; | 66 const BOP5_5 = 0x80 ^ 0x04; |
67 const BOP6 = BOOL_LIT && true; | 67 const BOP6 = BOOL_LIT && true; |
68 const BOP7 = false || BOOL_LIT; | 68 const BOP7 = false || BOOL_LIT; |
69 const BOP8 = STRING_LIT == "World!"; | 69 const BOP8 = STRING_LIT == "World!"; |
70 const BOP9 = "Hello" != STRING_LIT; | 70 const BOP9 = "Hello" != STRING_LIT; |
71 const BOP10 = INT_LIT === INT_LIT_REF; | 71 const BOP10 = INT_LIT == INT_LIT_REF; |
Lasse Reichstein Nielsen
2012/11/12 13:10:41
Use identical here too.
It is a compile-time const
floitsch
2012/11/12 22:18:43
identical doesn't yet work on compile-time constan
| |
72 const BOP11 = BOOL_LIT !== true; | 72 const BOP11 = BOOL_LIT != true; |
73 | 73 |
74 // Multiple binary expressions | 74 // Multiple binary expressions |
75 const BOP20 = 1 * INT_LIT / 3 + INT_LIT + 9; | 75 const BOP20 = 1 * INT_LIT / 3 + INT_LIT + 9; |
76 | 76 |
77 // Parenthised expressions | 77 // Parenthised expressions |
78 const BOP30 = ( 1 > 2 ); | 78 const BOP30 = ( 1 > 2 ); |
79 const BOP31 = (1 * 2) + 3; | 79 const BOP31 = (1 * 2) + 3; |
80 const BOP32= 3 + (1 * 2); | 80 const BOP32= 3 + (1 * 2); |
81 | 81 |
82 // Unary expressions | 82 // Unary expressions |
(...skipping 14 matching lines...) Expand all Loading... | |
97 const UOP3_6 = -DOUBLE_LIT + 123; | 97 const UOP3_6 = -DOUBLE_LIT + 123; |
98 const UOP3_7 = -(DOUBLE_LIT * 0xff); | 98 const UOP3_7 = -(DOUBLE_LIT * 0xff); |
99 | 99 |
100 class A { | 100 class A { |
101 const A(); | 101 const A(); |
102 static const a = const A(); // Assignment from Constant constructor OK | 102 static const a = const A(); // Assignment from Constant constructor OK |
103 } | 103 } |
104 | 104 |
105 main () { | 105 main () { |
106 } | 106 } |
OLD | NEW |