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

Side by Side Diff: test_reflectable/test/proxy_test.dart

Issue 1289933004: Implements support for reflection on parameters. (Closed) Base URL: https://github.com/dart-lang/reflectable.git@master
Patch Set: Merging with code from Sigurd, caused several adjustments Created 5 years, 4 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
OLDNEW
1 // Copyright (c) 2015, the Dart Team. All rights reserved. Use of this 1 // Copyright (c) 2015, the Dart Team. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in 2 // source code is governed by a BSD-style license that can be found in
3 // the LICENSE file. 3 // the LICENSE file.
4 4
5 // File being transformed by the reflectable transformer. 5 // File being transformed by the reflectable transformer.
6 // Implements a very simple kind of proxy object. 6 // Implements a very simple kind of proxy object.
7 7
8 library test_reflectable.test.proxy_test; 8 library test_reflectable.test.proxy_test;
9 9
10 import 'package:reflectable/reflectable.dart'; 10 import 'package:reflectable/reflectable.dart';
11 import 'package:unittest/unittest.dart'; 11 import 'package:unittest/unittest.dart';
12 12
13 class ProxyReflectable extends Reflectable { 13 class ProxyReflectable extends Reflectable {
14 const ProxyReflectable() 14 const ProxyReflectable()
15 : super(instanceInvokeCapability, typeCapability); 15 : super(instanceInvokeCapability, declarationsCapability);
16 } 16 }
17 const proxyReflectable = const ProxyReflectable(); 17 const proxyReflectable = const ProxyReflectable();
18 18
19 @proxyReflectable 19 @proxyReflectable
20 class A { 20 class A {
21 int i = 0; 21 int i = 0;
22 String foo() => i == 42 ? "OK!" : "Error!"; 22 String foo() => i == 42 ? "OK!" : "Error!";
23 void bar(int i) { 23 void bar(int i) {
24 this.i = i; 24 this.i = i;
25 } 25 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 final A a = new A(); 61 final A a = new A();
62 Proxy proxy = new Proxy(a, methodMapForA); 62 Proxy proxy = new Proxy(a, methodMapForA);
63 63
64 // Use it. 64 // Use it.
65 test("Using proxy", () { 65 test("Using proxy", () {
66 proxy.bar(42); 66 proxy.bar(42);
67 expect(a.i, 42); 67 expect(a.i, 42);
68 expect(proxy.foo(), "OK!"); 68 expect(proxy.foo(), "OK!");
69 }); 69 });
70 } 70 }
OLDNEW
« no previous file with comments | « test_reflectable/test/polymer_basic_needs_test.dart ('k') | test_reflectable/test/type_relations_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698