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

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

Issue 1181413005: Implement newInstance in the transformer. (Closed) Base URL: https://github.com/dart-lang/reflectable.git@master
Patch Set: Address review Created 5 years, 6 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
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698