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

Side by Side Diff: test_reflectable/test/polymer_basic_needs_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
« no previous file with comments | « test_reflectable/test/parameter_test.dart ('k') | test_reflectable/test/proxy_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // Testing the basic set of features that are needed for polymer. 5 // Testing the basic set of features that are needed for polymer.
6 6
7 library test_reflectable.test.polymer_basic_needs_test; 7 library test_reflectable.test.polymer_basic_needs_test;
8 8
9 import 'package:reflectable/reflectable.dart'; 9 import 'package:reflectable/reflectable.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 declaration.isGetter && 42 declaration.isGetter &&
43 !_hasSetter(declaration.owner, declaration)); 43 !_hasSetter(declaration.owner, declaration));
44 44
45 bool isMethod() => !isField() && !isProperty(); 45 bool isMethod() => !isField() && !isProperty();
46 46
47 return new ThinDeclarationMirror(declaration.simpleName, 47 return new ThinDeclarationMirror(declaration.simpleName,
48 declaration is VariableMirror, isProperty(), isFinal(), isMethod()); 48 declaration is VariableMirror, isProperty(), isFinal(), isMethod());
49 } 49 }
50 50
51 class MyReflectable extends Reflectable { 51 class MyReflectable extends Reflectable {
52 const MyReflectable() : super(instanceInvokeCapability); 52 const MyReflectable()
53 : super(instanceInvokeCapability, declarationsCapability);
53 } 54 }
55
54 const myReflectable = const MyReflectable(); 56 const myReflectable = const MyReflectable();
55 57
56 List<DeclarationMirror> _query(Type dartType) { 58 List<DeclarationMirror> _query(Type dartType) {
57 ClassMirror mirror = myReflectable.reflectType(dartType); 59 ClassMirror mirror = myReflectable.reflectType(dartType);
58 return mirror.declarations.values.toList(); 60 return mirror.declarations.values.toList();
59 } 61 }
60 62
61 List<ThinDeclarationMirror> buildMirrors(Type dartType) { 63 List<ThinDeclarationMirror> buildMirrors(Type dartType) {
62 return _query(dartType).map(makeThin).toList(); 64 return _query(dartType).map(makeThin).toList();
63 } 65 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 110 }
109 111
110 // Check other methods from `polymer_basic_needs_lib`. 112 // Check other methods from `polymer_basic_needs_lib`.
111 A a = new A(); 113 A a = new A();
112 write(a, "i", 7); 114 write(a, "i", 7);
113 expect(read(a, "i"), 7); 115 expect(read(a, "i"), 7);
114 invoke(a, "bar", [42]); 116 invoke(a, "bar", [42]);
115 expect(invoke(a, "foo", []), "OK!"); 117 expect(invoke(a, "foo", []), "OK!");
116 }); 118 });
117 } 119 }
OLDNEW
« no previous file with comments | « test_reflectable/test/parameter_test.dart ('k') | test_reflectable/test/proxy_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698