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

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

Issue 11273117: Fix issue 6403: do not crash if super indexed load does not exist (return 'no-such-method call' ins… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | « runtime/vm/flow_graph_builder.cc ('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
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 // Dart test for testing super operator calls 4 // Dart test for testing super operator calls
5 5
6 6
7 class A { 7 class A {
8 String val = ""; 8 String val = "";
9 List things; 9 List things;
10 10
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 operator []= (i, val) { 42 operator []= (i, val) {
43 // Make sure the index expression is only evaluated 43 // Make sure the index expression is only evaluated
44 // once in the presence of a compound assignment. 44 // once in the presence of a compound assignment.
45 return super[i++] += val; 45 return super[i++] += val;
46 } 46 }
47 47
48 } 48 }
49 49
50
51 class Autobianchi {
52 g() => super[0];
53 }
54
55
56 testRegression6403() {
57 // Do not crash, throw exception instead
58 new Autobianchi().g();
59 }
60
61
50 main () { 62 main () {
51 var a = new A(); 63 var a = new A();
52 a = a + "William"; // operator + of class A. 64 a = a + "William"; // operator + of class A.
53 Expect.equals("William", a.val); 65 Expect.equals("William", a.val);
54 Expect.equals("r", a[2]); // operator [] of class A. 66 Expect.equals("r", a[2]); // operator [] of class A.
55 67
56 a = new B(); 68 a = new B();
57 a += "Tell"; // operator + of class B. 69 a += "Tell"; // operator + of class B.
58 Expect.equals("TellTell", a.val); 70 Expect.equals("TellTell", a.val);
59 Expect.equals("rr", a[2]); // operator [] of class B. 71 Expect.equals("rr", a[2]); // operator [] of class B.
60 72
61 a[4] = 1; // operator []= of class B. 73 a[4] = 1; // operator []= of class B.
62 Expect.equals(43, a.things[4]); 74 Expect.equals(43, a.things[4]);
63 Expect.equals(86, a[4]); 75 Expect.equals(86, a[4]);
64 76
77 Expect.throws(testRegression6403);
65 } 78 }
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698