OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart'
; | 5 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart'
; |
6 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.
dart'; | 6 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.
dart'; |
7 | 7 |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 int count(Iterable iterable) { | 10 int count(Iterable iterable) { |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 var metadata9 = metadata[9]; | 299 var metadata9 = metadata[9]; |
300 Expect.isTrue(metadata9 is InstanceMirror); | 300 Expect.isTrue(metadata9 is InstanceMirror); |
301 Expect.isFalse(metadata9.hasReflectee); | 301 Expect.isFalse(metadata9.hasReflectee); |
302 Expect.throws(() => metadata9.reflectee, (_) => true); | 302 Expect.throws(() => metadata9.reflectee, (_) => true); |
303 Expect.equals(metadataType.originalDeclaration, metadata9.type); | 303 Expect.equals(metadataType.originalDeclaration, metadata9.type); |
304 metadata9.getField('data').then((InstanceMirror data) { | 304 metadata9.getField('data').then((InstanceMirror data) { |
305 Expect.isNotNull(data); | 305 Expect.isNotNull(data); |
306 Expect.isTrue(data.hasReflectee); | 306 Expect.isTrue(data.hasReflectee); |
307 Expect.isNull(data.reflectee); | 307 Expect.isNull(data.reflectee); |
308 }); | 308 }); |
| 309 |
| 310 ////////////////////////////////////////////////////////////////////////////// |
| 311 // Location test |
| 312 ////////////////////////////////////////////////////////////////////////////// |
| 313 |
| 314 var fooClassLocation = fooClass.location; |
| 315 Expect.isNotNull(fooClassLocation); |
| 316 // Expect the location to start with the first metadata. |
| 317 Expect.equals(348, fooClassLocation.offset, "Unexpected offset"); |
| 318 // Expect the location to end with the class body. |
| 319 Expect.equals(227, fooClassLocation.length, "Unexpected length"); |
| 320 Expect.equals(17, fooClassLocation.line, "Unexpected line"); |
| 321 Expect.equals(1, fooClassLocation.column, "Unexpected column"); |
| 322 |
309 } | 323 } |
310 | 324 |
311 // Testing abstract class Bar: | 325 // Testing abstract class Bar: |
312 // | 326 // |
313 // abstract class Bar<E> { | 327 // abstract class Bar<E> { |
314 // | 328 // |
315 // } | 329 // } |
316 void testBar(MirrorSystem system, LibraryMirror helperLibrary, | 330 void testBar(MirrorSystem system, LibraryMirror helperLibrary, |
317 Map<String,TypeMirror> classes) { | 331 Map<String,TypeMirror> classes) { |
318 var barClass = classes["Bar"]; | 332 var barClass = classes["Bar"]; |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 Expect.isTrue(privateFactoryConstructor.isPrivate); | 951 Expect.isTrue(privateFactoryConstructor.isPrivate); |
938 Expect.isFalse(privateFactoryConstructor.isConstConstructor); | 952 Expect.isFalse(privateFactoryConstructor.isConstConstructor); |
939 Expect.isFalse(privateFactoryConstructor.isRedirectingConstructor); | 953 Expect.isFalse(privateFactoryConstructor.isRedirectingConstructor); |
940 Expect.isFalse(privateFactoryConstructor.isGenerativeConstructor); | 954 Expect.isFalse(privateFactoryConstructor.isGenerativeConstructor); |
941 Expect.isTrue(privateFactoryConstructor.isFactoryConstructor); | 955 Expect.isTrue(privateFactoryConstructor.isFactoryConstructor); |
942 | 956 |
943 var metadata = privateClass.metadata; | 957 var metadata = privateClass.metadata; |
944 Expect.isNotNull(metadata); | 958 Expect.isNotNull(metadata); |
945 Expect.equals(0, metadata.length); | 959 Expect.equals(0, metadata.length); |
946 } | 960 } |
OLD | NEW |