| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2014, 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 // Check that compile-time evaluation of constants is consistent with runtime |
| 6 // evaluation. |
| 7 |
| 8 import 'dart:mirrors'; |
| 9 |
| 10 import 'package:expect/expect.dart'; |
| 11 |
| 12 const top_const = identical(-0.0, 0); |
| 13 final top_final = identical(-0.0, 0); |
| 14 var top_var = identical(-0.0, 0); |
| 15 |
| 16 @top_const |
| 17 class C { |
| 18 static const static_const = identical(-0.0, 0); |
| 19 static final static_final = identical(-0.0, 0); |
| 20 static var static_var = identical(-0.0, 0); |
| 21 |
| 22 final instance_final = identical(-0.0, 0); |
| 23 var instance_var = identical(-0.0, 0); |
| 24 |
| 25 void test() { |
| 26 const local_const = identical(-0.0, 0); |
| 27 final local_final = identical(-0.0, 0); |
| 28 var local_var = identical(-0.0, 0); |
| 29 |
| 30 Expect.equals(identical(-0.0, 0), top_const); |
| 31 Expect.equals(top_const, top_final); |
| 32 Expect.equals(top_final, top_var); |
| 33 Expect.equals(top_var, static_const); |
| 34 Expect.equals(static_const, static_final); |
| 35 Expect.equals(static_final, static_var); |
| 36 Expect.equals(static_var, instance_final); |
| 37 Expect.equals(instance_final, instance_var); |
| 38 Expect.equals(instance_var, local_const); |
| 39 Expect.equals(local_const, local_final); |
| 40 Expect.equals(local_final, local_var); |
| 41 var metadata = reflectClass(C).metadata[0].reflectee; /// 01: ok |
| 42 Expect.equals(top_const, metadata); /// 01: continued |
| 43 Expect.equals(local_var, metadata); /// 01: continued |
| 44 } |
| 45 } |
| 46 |
| 47 void main() { |
| 48 new C().test(); |
| 49 } |
| OLD | NEW |