| 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.declarations_test; | 5 library test.declarations_test; |
| 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 import 'stringify.dart'; | 10 import 'stringify.dart'; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 'Method(s(_staticSetter=) in s(Class), private, static, setter)', | 48 'Method(s(_staticSetter=) in s(Class), private, static, setter)', |
| 49 'Method(s(instanceSetter=) in s(Class), setter)', | 49 'Method(s(instanceSetter=) in s(Class), setter)', |
| 50 'Method(s(staticSetter=) in s(Class), static, setter)' | 50 'Method(s(staticSetter=) in s(Class), static, setter)' |
| 51 ], | 51 ], |
| 52 cm.declarations.values | 52 cm.declarations.values |
| 53 .where((dm) => dm is MethodMirror && dm.isSetter) | 53 .where((dm) => dm is MethodMirror && dm.isSetter) |
| 54 .map(stringify), | 54 .map(stringify), |
| 55 'setters'); | 55 'setters'); |
| 56 | 56 |
| 57 // dart2js stops testing here. | 57 // dart2js stops testing here. |
| 58 return; // //# 01: ok | 58 return; //# 01: ok |
| 59 | 59 |
| 60 Expect.setEquals( | 60 Expect.setEquals( |
| 61 [ | 61 [ |
| 62 'Method(s(+) in s(Class))', | 62 'Method(s(+) in s(Class))', |
| 63 'Method(s(_instanceMethod) in s(Class), private)', | 63 'Method(s(_instanceMethod) in s(Class), private)', |
| 64 'Method(s(_staticMethod) in s(Class), private, static)', | 64 'Method(s(_staticMethod) in s(Class), private, static)', |
| 65 'Method(s(abstractMethod) in s(Class), abstract)', | 65 'Method(s(abstractMethod) in s(Class), abstract)', |
| 66 'Method(s(instanceMethod) in s(Class))', | 66 'Method(s(instanceMethod) in s(Class))', |
| 67 'Method(s(staticMethod) in s(Class), static)' | 67 'Method(s(staticMethod) in s(Class), static)' |
| 68 ], | 68 ], |
| (...skipping 13 matching lines...) Expand all Loading... |
| 82 'Method(s(Class.generativeConstructor) in s(Class), constructor)', | 82 'Method(s(Class.generativeConstructor) in s(Class), constructor)', |
| 83 'Method(s(Class.normalFactory) in s(Class), static, constructor)', | 83 'Method(s(Class.normalFactory) in s(Class), static, constructor)', |
| 84 'Method(s(Class.redirectingConstructor) in s(Class), constructor)', | 84 'Method(s(Class.redirectingConstructor) in s(Class), constructor)', |
| 85 'Method(s(Class.redirectingFactory) in s(Class), static, constructor)' | 85 'Method(s(Class.redirectingFactory) in s(Class), static, constructor)' |
| 86 ], | 86 ], |
| 87 cm.declarations.values | 87 cm.declarations.values |
| 88 .where((dm) => dm is MethodMirror && dm.isConstructor) | 88 .where((dm) => dm is MethodMirror && dm.isConstructor) |
| 89 .map(stringify), | 89 .map(stringify), |
| 90 'constructors and factories'); | 90 'constructors and factories'); |
| 91 | 91 |
| 92 Expect.setEquals([ | 92 Expect.setEquals( |
| 93 'Method(s(Class._normalFactory) in s(Class), private, static, constructor)', | 93 [ |
| 94 'Method(s(Class._redirectingFactory)' | 94 'Method(s(Class._normalFactory) in s(Class), private, static, constructo
r)', |
| 95 ' in s(Class), private, static, constructor)', | 95 'Method(s(Class._redirectingFactory)' |
| 96 'Method(s(Class.normalFactory) in s(Class), static, constructor)', | 96 ' in s(Class), private, static, constructor)', |
| 97 'Method(s(Class.redirectingFactory) in s(Class), static, constructor)', | 97 'Method(s(Class.normalFactory) in s(Class), static, constructor)', |
| 98 'Method(s(_staticGetter) in s(Class), private, static, getter)', | 98 'Method(s(Class.redirectingFactory) in s(Class), static, constructor)', |
| 99 'Method(s(_staticMethod) in s(Class), private, static)', | 99 'Method(s(_staticGetter) in s(Class), private, static, getter)', |
| 100 'Method(s(_staticSetter=) in s(Class), private, static, setter)', | 100 'Method(s(_staticMethod) in s(Class), private, static)', |
| 101 'Variable(s(_staticVariable) in s(Class), private, static)', | 101 'Method(s(_staticSetter=) in s(Class), private, static, setter)', |
| 102 'Method(s(staticGetter) in s(Class), static, getter)', | 102 'Variable(s(_staticVariable) in s(Class), private, static)', |
| 103 'Method(s(staticMethod) in s(Class), static)', | 103 'Method(s(staticGetter) in s(Class), static, getter)', |
| 104 'Method(s(staticSetter=) in s(Class), static, setter)', | 104 'Method(s(staticMethod) in s(Class), static)', |
| 105 'Variable(s(staticVariable) in s(Class), static)' | 105 'Method(s(staticSetter=) in s(Class), static, setter)', |
| 106 ], cm.declarations.values.where((dm) => dm.isStatic).map(stringify), | 106 'Variable(s(staticVariable) in s(Class), static)' |
| 107 ], |
| 108 cm.declarations.values |
| 109 .where((dm) => (dm as dynamic).isStatic) |
| 110 .map(stringify), |
| 107 'statics'); | 111 'statics'); |
| 108 | 112 |
| 109 Expect.setEquals([ | 113 Expect.setEquals( |
| 110 'Method(s(+) in s(Class))', | 114 [ |
| 111 'TypeVariable(s(C) in s(Class),' | 115 'Method(s(+) in s(Class))', |
| 112 ' upperBound = Class(s(Object) in s(dart.core), top-level))', | 116 'TypeVariable(s(C) in s(Class),' |
| 113 'Method(s(Class._generativeConstructor) in s(Class), private, constructor)', | 117 ' upperBound = Class(s(Object) in s(dart.core), top-level))', |
| 114 'Method(s(Class._redirectingConstructor)' | 118 'Method(s(Class._generativeConstructor) in s(Class), private, constructo
r)', |
| 115 ' in s(Class), private, constructor)', | 119 'Method(s(Class._redirectingConstructor)' |
| 116 'Method(s(Class.generativeConstructor) in s(Class), constructor)', | 120 ' in s(Class), private, constructor)', |
| 117 'Method(s(Class.redirectingConstructor) in s(Class), constructor)', | 121 'Method(s(Class.generativeConstructor) in s(Class), constructor)', |
| 118 'Method(s(_instanceGetter) in s(Class), private, getter)', | 122 'Method(s(Class.redirectingConstructor) in s(Class), constructor)', |
| 119 'Method(s(_instanceMethod) in s(Class), private)', | 123 'Method(s(_instanceGetter) in s(Class), private, getter)', |
| 120 'Method(s(_instanceSetter=) in s(Class), private, setter)', | 124 'Method(s(_instanceMethod) in s(Class), private)', |
| 121 'Variable(s(_instanceVariable) in s(Class), private)', | 125 'Method(s(_instanceSetter=) in s(Class), private, setter)', |
| 122 'Method(s(abstractMethod) in s(Class), abstract)', | 126 'Variable(s(_instanceVariable) in s(Class), private)', |
| 123 'Method(s(instanceGetter) in s(Class), getter)', | 127 'Method(s(abstractMethod) in s(Class), abstract)', |
| 124 'Method(s(instanceMethod) in s(Class))', | 128 'Method(s(instanceGetter) in s(Class), getter)', |
| 125 'Method(s(instanceSetter=) in s(Class), setter)', | 129 'Method(s(instanceMethod) in s(Class))', |
| 126 'Variable(s(instanceVariable) in s(Class))' | 130 'Method(s(instanceSetter=) in s(Class), setter)', |
| 127 ], cm.declarations.values.where((dm) => !dm.isStatic).map(stringify), | 131 'Variable(s(instanceVariable) in s(Class))' |
| 132 ], |
| 133 cm.declarations.values |
| 134 .where((dm) => !(dm as dynamic).isStatic) |
| 135 .map(stringify), |
| 128 'non-statics'); | 136 'non-statics'); |
| 129 | 137 |
| 130 Expect.setEquals([ | 138 Expect.setEquals( |
| 131 'Method(s(+) in s(Class))', | 139 [ |
| 132 'TypeVariable(s(C) in s(Class),' | 140 'Method(s(+) in s(Class))', |
| 133 ' upperBound = Class(s(Object) in s(dart.core), top-level))', | 141 'TypeVariable(s(C) in s(Class),' |
| 134 'Method(s(Class.generativeConstructor) in s(Class), constructor)', | 142 ' upperBound = Class(s(Object) in s(dart.core), top-level))', |
| 135 'Method(s(Class.normalFactory) in s(Class), static, constructor)', | 143 'Method(s(Class.generativeConstructor) in s(Class), constructor)', |
| 136 'Method(s(Class.redirectingConstructor) in s(Class), constructor)', | 144 'Method(s(Class.normalFactory) in s(Class), static, constructor)', |
| 137 'Method(s(Class.redirectingFactory) in s(Class), static, constructor)', | 145 'Method(s(Class.redirectingConstructor) in s(Class), constructor)', |
| 138 'Method(s(abstractMethod) in s(Class), abstract)', | 146 'Method(s(Class.redirectingFactory) in s(Class), static, constructor)', |
| 139 'Method(s(instanceGetter) in s(Class), getter)', | 147 'Method(s(abstractMethod) in s(Class), abstract)', |
| 140 'Method(s(instanceMethod) in s(Class))', | 148 'Method(s(instanceGetter) in s(Class), getter)', |
| 141 'Method(s(instanceSetter=) in s(Class), setter)', | 149 'Method(s(instanceMethod) in s(Class))', |
| 142 'Variable(s(instanceVariable) in s(Class))', | 150 'Method(s(instanceSetter=) in s(Class), setter)', |
| 143 'Method(s(staticGetter) in s(Class), static, getter)', | 151 'Variable(s(instanceVariable) in s(Class))', |
| 144 'Method(s(staticMethod) in s(Class), static)', | 152 'Method(s(staticGetter) in s(Class), static, getter)', |
| 145 'Method(s(staticSetter=) in s(Class), static, setter)', | 153 'Method(s(staticMethod) in s(Class), static)', |
| 146 'Variable(s(staticVariable) in s(Class), static)' | 154 'Method(s(staticSetter=) in s(Class), static, setter)', |
| 147 ], cm.declarations.values.where((dm) => !dm.isPrivate).map(stringify), | 155 'Variable(s(staticVariable) in s(Class), static)' |
| 156 ], |
| 157 cm.declarations.values |
| 158 .where((dm) => !(dm as dynamic).isPrivate) |
| 159 .map(stringify), |
| 148 'public'); | 160 'public'); |
| 149 | 161 |
| 150 Expect.setEquals([ | 162 Expect.setEquals([ |
| 151 'Method(s(*) in s(Mixin))', | 163 'Method(s(*) in s(Mixin))', |
| 152 'Method(s(+) in s(Class))', | 164 'Method(s(+) in s(Class))', |
| 153 'Method(s(-) in s(Superclass))', | 165 'Method(s(-) in s(Superclass))', |
| 154 'Method(s(==) in s(Object))', | 166 'Method(s(==) in s(Object))', |
| 155 'TypeVariable(s(C) in s(Class),' | 167 'TypeVariable(s(C) in s(Class),' |
| 156 ' upperBound = Class(s(Object) in s(dart.core), top-level))', | 168 ' upperBound = Class(s(Object) in s(dart.core), top-level))', |
| 157 'Method(s(Class.generativeConstructor) in s(Class), constructor)', | 169 'Method(s(Class.generativeConstructor) in s(Class), constructor)', |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 'Method(s(_mixinStaticSetter=) in s(Mixin), private, static, setter)', | 359 'Method(s(_mixinStaticSetter=) in s(Mixin), private, static, setter)', |
| 348 'Method(s(_mixinStaticMethod) in s(Mixin), private, static)' | 360 'Method(s(_mixinStaticMethod) in s(Mixin), private, static)' |
| 349 ], | 361 ], |
| 350 inheritedDeclarations(cm) | 362 inheritedDeclarations(cm) |
| 351 .difference(reflectClass(Object).declarations.values.toSet()) | 363 .difference(reflectClass(Object).declarations.values.toSet()) |
| 352 .map(stringify), | 364 .map(stringify), |
| 353 'transitive less Object'); | 365 'transitive less Object'); |
| 354 // The private members of Object may vary across implementations, so we | 366 // The private members of Object may vary across implementations, so we |
| 355 // exclude the declarations of Object in this test case. | 367 // exclude the declarations of Object in this test case. |
| 356 } | 368 } |
| OLD | NEW |