| 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 library test.immutable_collections; | 5 library test.immutable_collections; |
| 6 | 6 |
| 7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
| 8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
| 9 | 9 |
| 10 someException(e) => e is Exception || e is Error; | 10 someException(e) => e is Exception || e is Error; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 checkMethod(MethodMirror mm) { | 36 checkMethod(MethodMirror mm) { |
| 37 checkList(mm.parameters, 'MethodMirror.parameters'); | 37 checkList(mm.parameters, 'MethodMirror.parameters'); |
| 38 checkList(mm.metadata, 'MethodMirror.metadata'); | 38 checkList(mm.metadata, 'MethodMirror.metadata'); |
| 39 | 39 |
| 40 mm.parameters.forEach(checkParameter); | 40 mm.parameters.forEach(checkParameter); |
| 41 } | 41 } |
| 42 | 42 |
| 43 checkClass(ClassMirror cm) { | 43 checkClass(ClassMirror cm) { |
| 44 checkMap(cm.members, 'ClassMirror.members'); | 44 checkMap(cm.declarations, 'ClassMirror.declarations'); |
| 45 checkMap(cm.variables, 'ClassMirror.variables'); | |
| 46 checkMap(cm.methods, 'ClassMirror.methods'); | |
| 47 checkMap(cm.getters, 'ClassMirror.getters'); | |
| 48 checkMap(cm.setters, 'ClassMirror.setters'); | |
| 49 checkMap(cm.constructors, 'ClassMirror.constructors'); | |
| 50 checkList(cm.metadata, 'ClassMirror.metadata'); | 45 checkList(cm.metadata, 'ClassMirror.metadata'); |
| 51 checkList(cm.superinterfaces, 'ClassMirror.superinterfaces'); | 46 checkList(cm.superinterfaces, 'ClassMirror.superinterfaces'); |
| 52 checkList(cm.typeArguments, 'ClassMirror.typeArguments'); | 47 checkList(cm.typeArguments, 'ClassMirror.typeArguments'); |
| 53 checkList(cm.typeVariables, 'ClassMirror.typeVariables'); | 48 checkList(cm.typeVariables, 'ClassMirror.typeVariables'); |
| 54 | 49 |
| 55 cm.methods.values.forEach(checkMethod); | 50 cm.declarations.values.forEach(checkDeclaration); |
| 56 cm.getters.values.forEach(checkMethod); | |
| 57 cm.setters.values.forEach(checkMethod); | |
| 58 cm.constructors.values.forEach(checkMethod); | |
| 59 cm.variables.values.forEach(checkVariable); | |
| 60 cm.typeVariables.forEach(checkTypeVariable); | 51 cm.typeVariables.forEach(checkTypeVariable); |
| 61 } | 52 } |
| 62 | 53 |
| 63 checkType(TypeMirror tm) { | 54 checkType(TypeMirror tm) { |
| 64 checkList(tm.metadata, 'TypeMirror.metadata'); | 55 checkList(tm.metadata, 'TypeMirror.metadata'); |
| 65 } | 56 } |
| 66 | 57 |
| 58 checkDeclaration(DeclarationMirror dm) { |
| 59 if (dm is MethodMirror) checkMethod(dm); |
| 60 if (dm is ClassMirror) checkClass(dm); |
| 61 if (dm is TypeMirror) checkType(dm); |
| 62 if (dm is VariableMirror) checkVariable(dm); |
| 63 if (dm is TypeVariableMirror) checkTypeVariable(dm); |
| 64 } |
| 65 |
| 67 checkLibrary(LibraryMirror lm) { | 66 checkLibrary(LibraryMirror lm) { |
| 68 checkMap(lm.members, 'LibraryMirror.members'); | 67 checkMap(lm.declarations, 'LibraryMirror.declarations'); |
| 69 checkMap(lm.variables, 'LibraryMirror.variables'); | |
| 70 checkMap(lm.classes, 'LibraryMirror.classes'); | |
| 71 checkMap(lm.types, 'LibraryMirror.types'); | |
| 72 checkMap(lm.functions, 'LibraryMirror.functions'); | |
| 73 checkMap(lm.getters, 'LibraryMirror.getters'); | |
| 74 checkMap(lm.setters, 'LibraryMirror.setters'); | |
| 75 checkList(lm.metadata, 'LibraryMirror.metadata'); | 68 checkList(lm.metadata, 'LibraryMirror.metadata'); |
| 76 | 69 |
| 77 lm.types.values.forEach(checkType); | 70 lm.declarations.values.forEach(checkDeclaration); |
| 78 lm.classes.values.forEach(checkClass); | |
| 79 lm.functions.values.forEach(checkMethod); | |
| 80 lm.getters.values.forEach(checkMethod); | |
| 81 lm.setters.values.forEach(checkMethod); | |
| 82 lm.variables.values.forEach(checkVariable); | |
| 83 } | 71 } |
| 84 | 72 |
| 85 main() { | 73 main() { |
| 86 currentMirrorSystem().libraries.values.forEach(checkLibrary); | 74 currentMirrorSystem().libraries.values.forEach(checkLibrary); |
| 87 checkType(currentMirrorSystem().voidType); | 75 checkType(currentMirrorSystem().voidType); |
| 88 checkType(currentMirrorSystem().dynamicType); | 76 checkType(currentMirrorSystem().dynamicType); |
| 89 } | 77 } |
| OLD | NEW |