| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This tests uses the multi-test "ok" feature: | 5 // This tests uses the multi-test "ok" feature: |
| 6 // none: Desired behaviour, passing on the VM. | 6 // none: Desired behaviour, passing on the VM. |
| 7 // 01: Trimmed version for dart2js. | 7 // 01: Trimmed version for dart2js. |
| 8 // | 8 // |
| 9 // TODO(rmacnak,ahe): Remove multi-test when VM and dart2js are on par. | 9 // TODO(rmacnak,ahe): Remove multi-test when VM and dart2js are on par. |
| 10 | 10 |
| 11 /** Test of [ParameterMirror]. */ | 11 /** Test of [ParameterMirror]. */ |
| 12 library test.parameter_test; | 12 library test.parameter_test; |
| 13 | 13 |
| 14 @MirrorsUsed(targets: 'test.parameter_test', override: '*') | 14 @MirrorsUsed(targets: const ['test.parameter_test', 'dart.core.int'], override:
'*') |
| 15 import 'dart:mirrors'; | 15 import 'dart:mirrors'; |
| 16 | 16 |
| 17 import 'package:expect/expect.dart'; | 17 import 'package:expect/expect.dart'; |
| 18 import 'stringify.dart'; | 18 import 'stringify.dart'; |
| 19 | 19 |
| 20 class B { | 20 class B { |
| 21 B(); | 21 B(); |
| 22 B.foo(int x); | 22 B.foo(int x); |
| 23 B.bar(int z, x); | 23 B.bar(int z, x); |
| 24 | 24 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 MethodMirror garply = cm.declarations[#garply]; | 147 MethodMirror garply = cm.declarations[#garply]; |
| 148 expect('Method(s(garply) in s(B))', garply); | 148 expect('Method(s(garply) in s(B))', garply); |
| 149 expect('[Parameter(s(y) in s(garply), optional, named,' | 149 expect('[Parameter(s(y) in s(garply), optional, named,' |
| 150 ' type = Class(s(int) in s(dart.core), top-level))]', | 150 ' type = Class(s(int) in s(dart.core), top-level))]', |
| 151 garply.parameters); | 151 garply.parameters); |
| 152 expect('Instance(value = <null>)', garply.parameters[0].defaultValue); | 152 expect('Instance(value = <null>)', garply.parameters[0].defaultValue); |
| 153 | 153 |
| 154 MethodMirror waldo = cm.declarations[#waldo]; | 154 MethodMirror waldo = cm.declarations[#waldo]; |
| 155 expect('Method(s(waldo) in s(B))', waldo); | 155 expect('Method(s(waldo) in s(B))', waldo); |
| 156 expect('[Parameter(s(z) in s(waldo),' | 156 expect('[Parameter(s(z) in s(waldo),' |
| 157 ' type = Class(s(int) in s(dart.core), top-level))]', | 157 ' type = Class(s(int) in s(dart.core), top-level))]', |
| 158 waldo.parameters); | 158 waldo.parameters); |
| 159 expect('<null>', waldo.parameters[0].defaultValue); | 159 expect('<null>', waldo.parameters[0].defaultValue); |
| 160 | 160 |
| 161 cm = reflectClass(C); | 161 cm = reflectClass(C); |
| 162 | 162 |
| 163 MethodMirror fooInC = cm.declarations[#foo]; | 163 MethodMirror fooInC = cm.declarations[#foo]; |
| 164 expect('Method(s(foo) in s(C))', fooInC); | 164 expect('Method(s(foo) in s(C))', fooInC); |
| 165 expect('[Parameter(s(a) in s(foo),' | 165 expect('[Parameter(s(a) in s(foo),' |
| 166 ' type = Class(s(int) in s(dart.core), top-level)), ' | 166 ' type = Class(s(int) in s(dart.core), top-level)), ' |
| 167 'Parameter(s(b) in s(foo),' | 167 'Parameter(s(b) in s(foo),' |
| 168 ' type = TypeVariable(s(S) in s(C),' | 168 ' type = TypeVariable(s(S) in s(C),' |
| 169 ' upperBound = Class(s(int) in s(dart.core), top-level)))]', | 169 ' upperBound = Class(s(int) in s(dart.core), top-level)))]', |
| 170 fooInC.parameters); | 170 fooInC.parameters); |
| 171 | 171 |
| 172 MethodMirror barInC = cm.declarations[#bar]; | 172 MethodMirror barInC = cm.declarations[#bar]; |
| 173 expect('Method(s(bar) in s(C))', barInC); | 173 expect('Method(s(bar) in s(C))', barInC); |
| 174 expect('[Parameter(s(a) in s(bar),' | 174 expect('[Parameter(s(a) in s(bar),' |
| 175 ' type = TypeVariable(s(S) in s(C),' | 175 ' type = TypeVariable(s(S) in s(C),' |
| 176 ' upperBound = Class(s(int) in s(dart.core), top-level))), ' | 176 ' upperBound = Class(s(int) in s(dart.core), top-level))), ' |
| 177 'Parameter(s(b) in s(bar),' | 177 'Parameter(s(b) in s(bar),' |
| 178 ' type = TypeVariable(s(T) in s(C),' | 178 ' type = TypeVariable(s(T) in s(C),' |
| 179 ' upperBound = Class(s(Object) in s(dart.core), top-level))), ' | 179 ' upperBound = Class(s(Object) in s(dart.core), top-level))), ' |
| 180 'Parameter(s(c) in s(bar),' | 180 'Parameter(s(c) in s(bar),' |
| 181 ' type = Class(s(num) in s(dart.core), top-level))]', | 181 ' type = Class(s(num) in s(dart.core), top-level))]', |
| 182 barInC.parameters); | 182 barInC.parameters); |
| 183 } | 183 } |
| OLD | NEW |