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

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

Issue 11231074: Change signature of noSuchMethod to take an InvocationMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: One more test expectation 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 4
5 class NoSuchMethodInfo { 5 class NoSuchMethodInfo {
6 Object receiver; 6 Object receiver;
7 String name; 7 String name;
8 List args; 8 List args;
9 NoSuchMethodInfo(Object r, String m, List a) 9 NoSuchMethodInfo(Object r, String m, List a)
10 : receiver = r, name = m, args = a; 10 : receiver = r, name = m, args = a;
11 } 11 }
12 12
13 class A { 13 class A {
14 noSuchMethod(String name, List args) { 14 noSuchMethod(InvocationMirror invocation) {
15 topLevelInfo = new NoSuchMethodInfo(this, name, args); 15 topLevelInfo = new NoSuchMethodInfo(this, invocation.memberName,
16 invocation.positionalArguments);
16 return topLevelInfo; 17 return topLevelInfo;
17 } 18 }
18 19
19 foo(a, b, c) { 20 foo(a, b, c) {
20 Expect.fail('Should never enter here'); 21 Expect.fail('Should never enter here');
21 } 22 }
22 } 23 }
23 24
24 // Used for the setter case. 25 // Used for the setter case.
25 NoSuchMethodInfo topLevelInfo; 26 NoSuchMethodInfo topLevelInfo;
26 27
27 main() { 28 main() {
28 A a = new A(); 29 A a = new A();
29 var info = a.foo(); 30 var info = a.foo();
30 Expect.equals('foo', info.name); 31 Expect.equals('foo', info.name);
31 Expect.isTrue(info.args.isEmpty); 32 Expect.isTrue(info.args.isEmpty);
32 Expect.isTrue(info.receiver === a); 33 Expect.isTrue(info.receiver === a);
33 34
34 info = a.foo(2); 35 info = a.foo(2);
35 Expect.equals('foo', info.name); 36 Expect.equals('foo', info.name);
36 Expect.isTrue(info.args.length == 1); 37 Expect.isTrue(info.args.length == 1);
37 Expect.isTrue(info.args[0] === 2); 38 Expect.isTrue(info.args[0] === 2);
38 Expect.isTrue(info.receiver === a); 39 Expect.isTrue(info.receiver === a);
39 40
40 info = a.bar; 41 info = a.bar;
41 Expect.equals('get:bar', info.name); 42 Expect.equals('bar', info.name);
42 Expect.isTrue(info.args.length == 0); 43 Expect.isTrue(info.args.length == 0);
43 Expect.isTrue(info.receiver === a); 44 Expect.isTrue(info.receiver === a);
44 45
45 a.bar = 2; 46 a.bar = 2;
46 info = topLevelInfo; 47 info = topLevelInfo;
47 Expect.equals('set:bar', info.name); 48 Expect.equals('bar', info.name);
48 Expect.isTrue(info.args.length == 1); 49 Expect.isTrue(info.args.length == 1);
49 Expect.isTrue(info.args[0] === 2); 50 Expect.isTrue(info.args[0] === 2);
50 Expect.isTrue(info.receiver === a); 51 Expect.isTrue(info.receiver === a);
51 } 52 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js_extra/dart2js_extra.status ('k') | tests/compiler/dart2js_extra/optional_parameter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698