Chromium Code Reviews

Side by Side Diff: tests/lib/mirrors/parameter_of_mixin_app_constructor_test.dart

Issue 212883009: Handle creating ParameterMirrors for the parameters of forwarding constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
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.
4
5 library test.parameter_of_mixin_app_constructor;
6
7 import 'dart:mirrors';
8 import 'stringify.dart';
9
10 class MapView {
11 final _map;
12 MapView(map) : this._map = map;
13 }
14
15 abstract class UnmodifiableMapMixin {
16 someFunctionality() {}
17 }
18
19 class UnmodifiableMapView1 extends MapView with UnmodifiableMapMixin {
20 UnmodifiableMapView1(map1) : super(map1);
21 }
22
23 class UnmodifiableMapView2 = MapView with UnmodifiableMapMixin;
24
25 soleConstructorOf(ClassMirror cm) {
26 return cm.declarations.values
27 .where((dm) => dm is MethodMirror && dm.isConstructor).single;
28 }
29
30 main() {
31 ClassMirror umv1 = reflectClass(UnmodifiableMapView1);
32 expect('[Parameter(s(map1) in s(UnmodifiableMapView1),'
33 ' type = Type(s(dynamic), top-level))]',
34 soleConstructorOf(umv1).parameters);
35 expect('[Parameter(s(map) in s(test.parameter_of_mixin_app_constructor.MapView '
36 ' with test.parameter_of_mixin_app_constructor.UnmodifiableMapMixin),'
37 ' type = Type(s(dynamic), top-level))]',
38 soleConstructorOf(umv1.superclass).parameters);
39 expect('[Parameter(s(map) in s(MapView),'
40 ' type = Type(s(dynamic), top-level))]',
41 soleConstructorOf(umv1.superclass.superclass).parameters);
42 expect('[]',
43 soleConstructorOf(umv1.superclass.superclass.superclass).parameters);
44
45 ClassMirror umv2 = reflectClass(UnmodifiableMapView2);
46 expect('[Parameter(s(map) in s(UnmodifiableMapView2),'
47 ' type = Type(s(dynamic), top-level))]',
48 soleConstructorOf(umv2).parameters);
49 expect('[Parameter(s(map) in s(MapView),'
50 ' type = Type(s(dynamic), top-level))]',
51 soleConstructorOf(umv2.superclass).parameters);
52 expect('[]',
53 soleConstructorOf(umv2.superclass.superclass).parameters);
54 }
OLDNEW
« runtime/vm/class_finalizer.cc ('K') | « tests/lib/mirrors/immutable_collections_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine