OLD | NEW |
(Empty) | |
| 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 |
| 3 // the LICENSE file. |
| 4 |
| 5 // File being transformed by the reflectable transformer. |
| 6 // Uses `invoke`. |
| 7 |
| 8 library reflectable.test.to_be_transformed.new_instance_test; |
| 9 |
| 10 import 'package:reflectable/reflectable.dart'; |
| 11 import 'package:unittest/unittest.dart'; |
| 12 |
| 13 class MyReflectable extends Reflectable { |
| 14 const MyReflectable() : super(newInstanceCapability); |
| 15 } |
| 16 |
| 17 const myReflectable = const MyReflectable(); |
| 18 |
| 19 @myReflectable |
| 20 class A { |
| 21 static const localConstant = 10; |
| 22 A.optional([int z = localConstant]) : f = z; |
| 23 int f = 0; |
| 24 } |
| 25 |
| 26 main() { |
| 27 ClassMirror classMirror = myReflectable.reflectType(A); |
| 28 test('newInstance named arguments default argument, local constant', () { |
| 29 expect((classMirror.newInstance("optional", [], {}) as A).f, 10); |
| 30 }); |
| 31 } |
OLD | NEW |