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

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

Issue 12499005: dart2js: Create noSuchMethod handlers at runtime to reduce overhead. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reordered some stuff due to code review feedback 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
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 program testing overridden messageNotUnderstood. 4 // Dart test program testing overridden messageNotUnderstood.
5 5
6 class GetName {
7 foo(a, b) => "foo";
8 }
9
10 String getName(im) => im.invokeOn(new GetName());
11
6 class OverriddenNoSuchMethod { 12 class OverriddenNoSuchMethod {
7 13
8 OverriddenNoSuchMethod() {} 14 OverriddenNoSuchMethod() {}
9 15
10 noSuchMethod(InvocationMirror mirror) { 16 noSuchMethod(InvocationMirror mirror) {
11 Expect.equals("foo", mirror.memberName); 17 Expect.equals("foo", getName(mirror));
12 // 'foo' was called with two parameters (not counting receiver). 18 // 'foo' was called with two parameters (not counting receiver).
13 List args = mirror.positionalArguments; 19 List args = mirror.positionalArguments;
14 Expect.equals(2, args.length); 20 Expect.equals(2, args.length);
15 Expect.equals(101, args[0]); 21 Expect.equals(101, args[0]);
16 Expect.equals(202, args[1]); 22 Expect.equals(202, args[1]);
17 return 5; 23 return 5;
18 } 24 }
19 25
20 static testMain() { 26 static testMain() {
21 var obj = new OverriddenNoSuchMethod(); 27 var obj = new OverriddenNoSuchMethod();
22 Expect.equals(5, obj.foo(101, 202)); 28 Expect.equals(5, obj.foo(101, 202));
23 } 29 }
24 } 30 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698