| 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= |
| 5 // VMOptions=--compile_all |
| 4 | 6 |
| 5 // Exercises language constructs that require compile time constants | 7 // Exercises language constructs that require compile time constants |
| 6 | 8 |
| 7 // Initialize with different literal types | 9 // Initialize with different literal types |
| 8 final b = true; | 10 final b = true; |
| 9 final s = "apple"; | 11 final s = "apple"; |
| 10 final i = 1; | 12 final i = 1; |
| 11 final d = 3.3; | 13 final d = 3.3; |
| 12 final h = 0xf; | 14 final h = 0xf; |
| 13 final n = null; | 15 final n = null; |
| 14 final aList = const[1, 2, 3]; // array literal | 16 final aList = const[1, 2, 3]; // array literal |
| 15 final aMap = const { "1": "one", "2": "banana" }; // map literal | 17 final aMap = const { "1": "one", "2": "banana" }; // map literal |
| 16 final value0 = aList[0]; // array access | |
| 17 final value1 = aList[i]; | |
| 18 | 18 |
| 19 final INT_LIT = 5; | 19 final INT_LIT = 5; |
| 20 final INT_LIT_REF = INT_LIT; | 20 final INT_LIT_REF = INT_LIT; |
| 21 final DOUBLE_LIT = 1.5; | 21 final DOUBLE_LIT = 1.5; |
| 22 final BOOL_LIT = true; | 22 final BOOL_LIT = true; |
| 23 final STRING_LIT = "Hello"; | 23 final STRING_LIT = "Hello"; |
| 24 | 24 |
| 25 final BOP1_0 = INT_LIT + 1; | 25 final BOP1_0 = INT_LIT + 1; |
| 26 final BOP1_1 = 1 + INT_LIT; | 26 final BOP1_1 = 1 + INT_LIT; |
| 27 final BOP1_2 = INT_LIT - 1; | 27 final BOP1_2 = INT_LIT - 1; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 final UOP3_6 = -DOUBLE_LIT + 123; | 97 final UOP3_6 = -DOUBLE_LIT + 123; |
| 98 final UOP3_7 = -(DOUBLE_LIT * 0xff); | 98 final UOP3_7 = -(DOUBLE_LIT * 0xff); |
| 99 | 99 |
| 100 class A { | 100 class A { |
| 101 const A(); | 101 const A(); |
| 102 static final a = const A(); // Assignment from Constant constructor OK | 102 static final a = const A(); // Assignment from Constant constructor OK |
| 103 } | 103 } |
| 104 | 104 |
| 105 main () { | 105 main () { |
| 106 } | 106 } |
| OLD | NEW |