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

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

Issue 2837243002: Redo "dart2js: --fast-startup: use alias for 'this'" (Closed)
Patch Set: add test Created 3 years, 7 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
« 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) 2017, 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 // Dart test program for testing setting/getting of instance fields.
5
6 import "package:expect/expect.dart";
7
8 // dart2js used to have a bug where a local called '_' in the constructor
9 // shadowed the parameter named after a field. This lead to the field being
10 // initialized to 'this' (a cycle) rather than the correct initializer value.
11 //
12 // This test is in the language tests rather than dart2js specific tests since
13 // the dart2js specific tests are not run in all configurations that coudl
14 // tickle this issue.
15
16 int ii = 0;
17
18 class Thing {
19 var _;
20 var $_;
21 // Extra fields to make use of local in constructor benficial and to exhaust
22 // single-character names.
23 var a = ++ii, b = ++ii, c = ++ii, d = ++ii, e = ++ii;
24 var f = ++ii, g = ++ii, h = ++ii, i = ++ii, j = ++ii;
25 var k = ++ii, l = ++ii, m = ++ii, n = ++ii, o = ++ii;
26 var p = ++ii, q = ++ii, r = ++ii, s = ++ii, t = ++ii;
27 var u = ++ii, v = ++ii, w = ++ii, x = ++ii, y = ++ii;
28 var z = ++ii;
29 var A = ++ii, B = ++ii, C = ++ii, D = ++ii, E = ++ii;
30 var F = ++ii, G = ++ii, H = ++ii, I = ++ii, J = ++ii;
31 var K = ++ii, L = ++ii, M = ++ii, N = ++ii, O = ++ii;
32 var P = ++ii, Q = ++ii, R = ++ii, S = ++ii, T = ++ii;
33 var U = ++ii, V = ++ii, W = ++ii, X = ++ii, Y = ++ii;
34 var Z = ++ii;
35 var $ = ++ii;
36
37 var f30 = ++ii, f31 = ++ii, f32 = ++ii, f33 = ++ii, f34 = ++ii;
38 var f35 = ++ii, f36 = ++ii, f37 = ++ii, f38 = ++ii, f39 = ++ii;
39 var f40 = ++ii, f41 = ++ii, f42 = ++ii, f43 = ++ii, f44 = ++ii;
40 var f45 = ++ii, f46 = ++ii, f47 = ++ii, f48 = ++ii, f49 = ++ii;
41 var f50 = ++ii, f51 = ++ii, f52 = ++ii, f53 = ++ii, f54 = ++ii;
42 var f55 = ++ii, f56 = ++ii, f57 = ++ii, f58 = ++ii, f59 = ++ii;
43
44 @NoInline()
45 Thing(this._, this.$_);
46 toString() {
47 if (depth > 0) return 'recursion!';
48 try {
49 ++depth;
50 var sum = a +
51 b +
52 c +
53 d +
54 e +
55 f +
56 g +
57 h +
58 i +
59 j +
60 k +
61 l +
62 m +
63 n +
64 o +
65 p +
66 q +
67 r +
68 s +
69 t +
70 u +
71 v +
72 w +
73 x +
74 y +
75 z +
76 A +
77 B +
78 C +
79 D +
80 E +
81 F +
82 G +
83 H +
84 I +
85 J +
86 K +
87 L +
88 M +
89 N +
90 O +
91 P +
92 Q +
93 R +
94 S +
95 T +
96 U +
97 V +
98 W +
99 X +
100 Y +
101 Z +
102 $ +
103 f30 +
104 f31 +
105 f32 +
106 f33 +
107 f34 +
108 f35 +
109 f36 +
110 f37 +
111 f38 +
112 f39 +
113 f40 +
114 f41 +
115 f42 +
116 f43 +
117 f44 +
118 f45 +
119 f46 +
120 f47 +
121 f48 +
122 f49 +
123 f50 +
124 f51 +
125 f52 +
126 f53 +
127 f54 +
128 f55 +
129 f56 +
130 f57 +
131 f58 +
132 f59;
133 return 'Thing(${_}, ${$_}, ${sum})';
134 } finally {
135 --depth;
136 }
137 }
138
139 static int depth = 0;
140 }
141
142 main() {
143 var t1 = new Thing(1, 2);
144 var t2 = new Thing(3, 4);
145 var t3 = [];
146
147 Expect.equals(
148 '[Thing(1, 2, 3486), Thing(3, 4, 10375), []]', '${[t1, t2, t3]}');
149 }
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