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

Side by Side Diff: tests/language/const_evaluation_test.dart

Issue 221873002: Compute frontend/backend specific constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « tests/language/const_constructor3_test.dart ('k') | tests/language/const_init2_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « tests/language/const_constructor3_test.dart ('k') | tests/language/const_init2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698