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

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

Issue 15979010: Fix two bugs in the Dart VM's super-noSuchMethod invocation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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/language.status ('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 unresolved super[] and super[]= and correct evaluation order.
6
7 import "package:expect/expect.dart";
8
9 class A {
10 var indexField = new List(2);
11
12 noSuchMethod(Invocation im) {
13 if (im.memberName == const Symbol('[]=')) {
14 Expect.equals(2, im.positionalArguments.length);
15 indexField[im.positionalArguments[0]] = im.positionalArguments[1];
16 } else if (im.memberName == const Symbol('[]')) {
17 Expect.equals(1, im.positionalArguments.length);
18 return indexField[im.positionalArguments[0]];
19 } else {
20 Expect.fail('Should not reach here');
21 }
22 }
23 }
24
25 var global = 0;
26
27 f() {
28 Expect.equals(0, global++);
29 return 0;
30 }
31
32 g() {
33 Expect.equals(1, global++);
34 return 42;
35 }
36
37 class B extends A {
38 test() {
39 Expect.equals(42, super[f()] = g());
40 Expect.equals(2, global);
41 }
42 }
43
44 main() {
45 new B().test();
46 }
OLDNEW
« no previous file with comments | « tests/language/language.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698