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

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

Issue 13094013: Fix bug 9239 by always evaluating the receiver before the value in an instance SendSet. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | « sdk/lib/_internal/compiler/implementation/ssa/builder.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) 2013, 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 // Test for the evaluation order of getters and setters.
6
7 var trace;
8
9 class X {
10 get b {
11 trace.add('get b');
12 return new X();
13 }
14
15 set c (value) {
16 trace.add('set c');
17 }
18
19 toString() {
20 trace.add('toString');
21 return 'X';
22 }
23
24 get c {
25 trace.add('get c');
26 return 42;
27 }
28
29 get d {
30 trace.add('get d');
31 return new X();
32 }
33
34 operator [] (index) {
35 trace.add('index');
36 return 42;
37 }
38
39 operator []=(index, value) {
40 trace.add('indexSet');
41 }
42 }
43
44 main() {
45 var x = new X();
46
47 trace = [];
48 x.b.c = '$x';
49 Expect.listEquals(['get b', 'toString', 'set c'], trace);
50
51 trace = [];
52 x.b.c += '$x'.hashCode;
53 Expect.listEquals(['get b', 'get c', 'toString', 'set c'], trace);
54
55 trace = [];
56 x.b.c++;
57 Expect.listEquals(['get b', 'get c', 'set c'], trace);
58
59 trace = [];
60 x.b.d[42] = '$x';
61 Expect.listEquals(['get b', 'get d', 'toString', 'indexSet'], trace);
62
63 trace = [];
64 x.b.d[42] += '$x'.hashCode;
65 Expect.listEquals(['get b', 'get d', 'index', 'toString', 'indexSet'], trace);
66
67 trace = [];
68 x.b.d[42]++;
69 Expect.listEquals(['get b', 'get d', 'index', 'indexSet'], trace);
70
71 trace = [];
72 ++x.b.d[42];
73 Expect.listEquals(['get b', 'get d', 'index', 'indexSet'], trace);
74 }
sra1 2013/03/26 21:45:58 Add some more complex compound assignments x.b.d[
ngeoffray 2013/03/28 11:31:03 Done.
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698