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

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

Issue 14251021: Move invokeOn to InstanceMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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) 2013, the Dart project authors. Please see the AUTHORS file 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 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 import "dart:mirrors" show reflect;
5 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
6 7
7 class Proxy { 8 class Proxy {
8 final proxied; 9 final proxied;
9 Proxy(this.proxied); 10 Proxy(this.proxied);
10 noSuchMethod(mirror) => mirror.invokeOn(proxied); 11 noSuchMethod(mirror) => reflect(proxied).delegate(mirror);
11 } 12 }
12 13
13 main() { 14 main() {
14 testList(); 15 testList();
15 testString(); 16 testString();
16 testInt(); 17 testInt();
17 testDouble(); 18 testDouble();
18 } 19 }
19 20
20 testList() { 21 testList() {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 testDouble() { 72 testDouble() {
72 var number = 42.99; 73 var number = 42.99;
73 var proxy = new Proxy(number); 74 var proxy = new Proxy(number);
74 75
75 Expect.equals(number + 87, proxy + 87); 76 Expect.equals(number + 87, proxy + 87);
76 Expect.equals(number.toInt(), proxy.toInt()); 77 Expect.equals(number.toInt(), proxy.toInt());
77 78
78 Expect.throws(() => proxy.funky(), (e) => e is NoSuchMethodError); 79 Expect.throws(() => proxy.funky(), (e) => e is NoSuchMethodError);
79 Expect.throws(() => number.funky(), (e) => e is NoSuchMethodError); 80 Expect.throws(() => number.funky(), (e) => e is NoSuchMethodError);
80 } 81 }
OLDNEW
« no previous file with comments | « dart/tests/language/invocation_mirror2_test.dart ('k') | dart/tests/language/invocation_mirror_invoke_on_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698