OLD | NEW |
(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 expectParameters(MethodMirror mm, List parameterNames) { |
| 26 Expect.listEquals(mm, ) |
| 27 } |
| 28 |
| 29 soleConstructorOf(ClassMirror cm) { |
| 30 return cm.declarations.values |
| 31 .where((dm) => dm is MethodMirror && dm.isConstructor).single; |
| 32 } |
| 33 |
| 34 main() { |
| 35 ClassMirror umv1 = reflectClass(UnmodifiableMapView1); |
| 36 expect('[Parameter(s(map1) in s(UnmodifiableMapView1),' |
| 37 ' type = Type(s(dynamic), top-level))]', |
| 38 soleConstructorOf(umv1).parameters); |
| 39 expect('[Parameter(s(map) in s(test.parameter_of_mixin_app_constructor.MapView
' |
| 40 ' with test.parameter_of_mixin_app_constructor.UnmodifiableMapMixin),' |
| 41 ' type = Type(s(dynamic), top-level))]', |
| 42 soleConstructorOf(umv1.superclass).parameters); |
| 43 expect('[Parameter(s(map) in s(MapView),' |
| 44 ' type = Type(s(dynamic), top-level))]', |
| 45 soleConstructorOf(umv1.superclass.superclass).parameters); |
| 46 expect('[]', |
| 47 soleConstructorOf(umv1.superclass.superclass.superclass).parameters); |
| 48 |
| 49 ClassMirror umv2 = reflectClass(UnmodifiableMapView2); |
| 50 expect('[Parameter(s(map) in s(UnmodifiableMapView2),' |
| 51 ' type = Type(s(dynamic), top-level))]', |
| 52 soleConstructorOf(umv2).parameters); |
| 53 expect('[Parameter(s(map) in s(MapView),' |
| 54 ' type = Type(s(dynamic), top-level))]', |
| 55 soleConstructorOf(umv2.superclass).parameters); |
| 56 expect('[]', |
| 57 soleConstructorOf(umv2.superclass.superclass).parameters); |
| 58 } |
OLD | NEW |