Chromium Code Reviews| 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; | |
|
eernst
2015/06/18 13:35:41
Looks like the separation I suggested in .status h
sigurdm
2015/06/19 07:50:54
No - this is an example of a default value that we
| |
| 9 | |
| 10 import 'package:reflectable/reflectable.dart'; | |
| 11 import 'package:unittest/unittest.dart'; | |
| 12 | |
| 13 class MyReflectable extends Reflectable { | |
| 14 const MyReflectable() : super(invokeConstructorsCapability); | |
| 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 |