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

Side by Side Diff: tests/compiler/dart2js_extra/many_constants_test.dart

Issue 1511383002: Revert "Canonical output ordering for constants." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart ('k') | no next file » | 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) 2015, 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 // This program has many similar constants that should all have distinct
6 // identities. They are sufficiently similar to have name collisions and need
7 // ordering by constant value.
8
9 import "package:expect/expect.dart";
10
11 enum E { A, B, C, D }
12
13 class Z {
14 final a, b, c, d, e, f;
15 const Z({this.a: 1, this.b: 1, this.c: 1, this.d: 1, this.e: 1, this.f: 1});
16 }
17
18 const c1 = const {};
19 const c2 = const <int, int>{};
20 const c3 = const <dynamic, int>{};
21 const c4 = const <int, dynamic>{};
22 const l1 = const [];
23 const l2 = const <int>[];
24 const l3 = const <String>[];
25 const l4 = const <num>[];
26
27 const ll1 = const [1, 2, 3, 4, 5, 6, 7];
28 const ll2 = const [1, 8, 3, 4, 5, 6, 7];
29 const ll3 = const [1, 2, 8, 4, 5, 6, 7];
30 const ll4 = const [1, 2, 3, 4, 8, 6, 7];
31
32 const m1 = const {1: 1, 2: 2};
33 const m2 = const {1: 2, 2: 1};
34 const m3 = const {1: 1, 2: 1};
35 const m4 = const {1: 2, 2: 2};
36 const m5 = const {2: 1, 1: 2};
37 const m6 = const {2: 2, 1: 1};
38 const m7 = const {2: 1, 1: 1};
39 const m8 = const {2: 2, 1: 2};
40 const m9 = const <int,int>{1: 1, 2: 2};
41 const mA = const <int,int>{1: 2, 2: 1};
42 const mB = const <int,int>{1: 1, 2: 1};
43 const mC = const <int,int>{1: 2, 2: 2};
44
45 const mE1 = const {E.A: E.B};
46 const mE2 = const {E.A: E.C};
47 const mE3 = const {E.A: 0, E.B: 0};
48 const mE4 = const {E.A: 0, E.C: 0};
49 const mE5 = const {E.A: 0, E.B: 0, E.C: 4};
50 const mE6 = const {E.A: 0, E.B: 0, E.C: 2};
51 const mE7 = const {E.A: 0, E.B: 0, E.C: 3};
52 const mE8 = const {E.A: 0, E.B: 0, E.C: 1};
53
54 const z1 = const Z(f: 3);
55 const z2 = const Z(f: 2);
56 const z3 = const Z(f: 1);
57 const z4 = const Z(e: 2);
58 const z5 = const Z(d: 3);
59 const z6 = const Z(d: 2);
60
61 makeAll() => {
62 'E.A': E.A, 'E.B': E.B, 'E.C': E.C, 'E.D': E.D,
63 'c1': c1, 'c2': c2, 'c3': c3, 'c4': c4,
64 'l1': l1, 'l2': l2, 'l3': l3, 'l4': l4,
65 'll1': ll1, 'll2': ll2, 'll3': ll3, 'l4': ll4,
66 'm1': m1, 'm2': m2, 'm3': m3, 'm4': m4,
67 'm5': m5, 'm6': m6, 'm7': m7, 'm8': m8,
68 'm9': m9, 'mA': mA, 'mB': mB, 'mC': mC,
69 'mE1': mE1, 'mE2': mE2, 'mE3': mE3, 'mE4': mE4,
70 'mE5': mE5, 'mE6': mE6, 'mE7': mE7, 'mE8': mE8,
71 'z1': z1, 'z2': z2, 'z3': z3, 'z4': z4, 'z5': z5, 'z6': z6,
72 };
73
74 main() {
75 var all1 = makeAll();
76 var all2 = makeAll();
77
78 for (var name1 in all1.keys) {
79 var e1 = all1[name1];
80 for (var name2 in all2.keys) {
81 if (name1 == name2) continue;
82 var e2 = all2[name2];
83 Expect.isFalse(identical(e1, e2),
84 'Different instances $name1: $e1 $name2: $e2');
85 }
86 }
87 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698