Chromium Code Reviews| 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.constructor_kinds_test; | 5 library test.constructor_kinds_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 class ClassWithDefaultConstructor {} | 10 class ClassWithDefaultConstructor {} |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 const Class.constRedirectingFactory(); | 35 const Class.constRedirectingFactory(); |
| 36 | 36 |
| 37 cm = reflectClass(ClassWithDefaultConstructor); | 37 cm = reflectClass(ClassWithDefaultConstructor); |
| 38 mm = cm.constructors.values.single; | 38 mm = cm.constructors.values.single; |
| 39 Expect.isTrue(mm.isConstructor); | 39 Expect.isTrue(mm.isConstructor); |
| 40 Expect.isTrue(mm.isGenerativeConstructor); | 40 Expect.isTrue(mm.isGenerativeConstructor); |
| 41 Expect.isFalse(mm.isFactoryConstructor); | 41 Expect.isFalse(mm.isFactoryConstructor); |
| 42 Expect.isFalse(mm.isRedirectingConstructor); | 42 Expect.isFalse(mm.isRedirectingConstructor); |
| 43 Expect.isFalse(mm.isConstConstructor); | 43 Expect.isFalse(mm.isConstConstructor); |
| 44 | 44 |
| 45 | |
| 46 cm = reflectClass(Class); | 45 cm = reflectClass(Class); |
| 47 | 46 |
| 48 mm = cm.constructors[#generative]; | 47 mm = cm.constructors[#Class.generative]; |
| 49 Expect.isTrue(mm.isConstructor); | 48 Expect.isTrue(mm.isConstructor); |
| 50 Expect.isTrue(mm.isGenerativeConstructor); | 49 Expect.isTrue(mm.isGenerativeConstructor); |
| 51 Expect.isFalse(mm.isFactoryConstructor); | 50 Expect.isFalse(mm.isFactoryConstructor); |
| 52 Expect.isFalse(mm.isRedirectingConstructor); | 51 Expect.isFalse(mm.isRedirectingConstructor); |
| 53 Expect.isFalse(mm.isConstConstructor); | 52 Expect.isFalse(mm.isConstConstructor); |
| 54 | 53 |
| 55 mm = cm.constructors[#redirectingGenerative]; | 54 mm = cm.constructors[#Class.redirectingGenerative]; |
| 56 Expect.isTrue(mm.isConstructor); | 55 Expect.isTrue(mm.isConstructor); |
| 57 Expect.isTrue(mm.isGenerativeConstructor); | 56 Expect.isTrue(mm.isGenerativeConstructor); |
| 58 Expect.isFalse(mm.isFactoryConstructor); | 57 Expect.isFalse(mm.isFactoryConstructor); |
| 59 Expect.isTrue(mm.isRedirectingConstructor); | 58 Expect.isTrue(mm.isRedirectingConstructor); |
| 60 Expect.isFalse(mm.isConstConstructor); | 59 Expect.isFalse(mm.isConstConstructor); |
| 61 | 60 |
| 62 mm = cm.constructors[#faktory]; | 61 mm = cm.constructors[#Class.faktory]; |
| 63 Expect.isTrue(mm.isConstructor); | 62 Expect.isTrue(mm.isConstructor); |
| 64 Expect.isFalse(mm.isGenerativeConstructor); | 63 Expect.isFalse(mm.isGenerativeConstructor); |
| 65 Expect.isTrue(mm.isFactoryConstructor); | 64 Expect.isTrue(mm.isFactoryConstructor); |
| 66 Expect.isFalse(mm.isRedirectingConstructor); | 65 Expect.isFalse(mm.isRedirectingConstructor); |
| 67 Expect.isFalse(mm.isConstConstructor); | 66 Expect.isFalse(mm.isConstConstructor); |
| 68 | 67 |
| 69 mm = cm.constructors[#redirectingFactory]; | 68 mm = cm.constructors[#Class.redirectingFactory]; |
| 70 Expect.isTrue(mm.isConstructor); | 69 Expect.isTrue(mm.isConstructor); |
| 71 Expect.isFalse(mm.isGenerativeConstructor); | 70 Expect.isFalse(mm.isGenerativeConstructor); |
| 72 Expect.isTrue(mm.isFactoryConstructor); | 71 Expect.isTrue(mm.isFactoryConstructor); |
| 73 Expect.isTrue(mm.isRedirectingConstructor); | 72 Expect.isTrue(mm.isRedirectingConstructor); |
| 74 Expect.isFalse(mm.isConstConstructor); | 73 Expect.isFalse(mm.isConstConstructor); |
| 75 | 74 |
| 76 mm = cm.constructors[#constGenerative]; | 75 mm = cm.constructors[#Class.constGenerative]; |
| 77 Expect.isTrue(mm.isConstructor); | 76 Expect.isTrue(mm.isConstructor); |
| 78 Expect.isTrue(mm.isGenerativeConstructor); | 77 Expect.isTrue(mm.isGenerativeConstructor); |
| 79 Expect.isFalse(mm.isFactoryConstructor); | 78 Expect.isFalse(mm.isFactoryConstructor); |
| 80 Expect.isFalse(mm.isRedirectingConstructor); | 79 Expect.isFalse(mm.isRedirectingConstructor); |
| 81 Expect.isTrue(mm.isConstConstructor); | 80 Expect.isTrue(mm.isConstConstructor); |
| 82 | 81 |
| 83 mm = cm.constructors[#constRedirectingGenerative]; | 82 mm = cm.constructors[#Class.constRedirectingGenerative]; |
| 84 Expect.isTrue(mm.isConstructor); | 83 Expect.isTrue(mm.isConstructor); |
| 85 Expect.isTrue(mm.isGenerativeConstructor); | 84 Expect.isTrue(mm.isGenerativeConstructor); |
| 86 Expect.isFalse(mm.isFactoryConstructor); | 85 Expect.isFalse(mm.isFactoryConstructor); |
| 87 Expect.isTrue(mm.isRedirectingConstructor); | 86 Expect.isTrue(mm.isRedirectingConstructor); |
| 88 Expect.isTrue(mm.isConstConstructor); | 87 Expect.isTrue(mm.isConstConstructor); |
| 89 | 88 |
| 90 // Not legal. | 89 // Not legal. |
| 91 // mm = cm.constructors[#constFaktory]; | 90 // mm = cm.constructors[#Class.constFaktory]; |
| 92 // Expect.isTrue(mm.isConstructor); | 91 // Expect.isTrue(mm.isConstructor); |
| 93 // Expect.isFalse(mm.isGenerativeConstructor); | 92 // Expect.isFalse(mm.isGenerativeConstructor); |
| 94 // Expect.isTrue(mm.isFactoryConstructor); | 93 // Expect.isTrue(mm.isFactoryConstructor); |
| 95 // Expect.isFalse(mm.isRedirectingConstructor); | 94 // Expect.isFalse(mm.isRedirectingConstructor); |
| 96 // Expect.isTrue(mm.isConstConstructor); | 95 // Expect.isTrue(mm.isConstConstructor); |
| 97 | 96 |
| 98 mm = cm.constructors[#constRedirectingFactory]; | 97 mm = cm.constructors[#Class.constRedirectingFactory]; |
|
siva
2013/10/09 16:05:50
I was initially confused by this naming pattern fo
rmacnak
2013/10/09 17:13:51
Fixed. I notice the VM internally is inconsistent
| |
| 99 Expect.isTrue(mm.isConstructor); | 98 Expect.isTrue(mm.isConstructor); |
| 100 Expect.isFalse(mm.isGenerativeConstructor); | 99 Expect.isFalse(mm.isGenerativeConstructor); |
| 101 Expect.isTrue(mm.isFactoryConstructor); | 100 Expect.isTrue(mm.isFactoryConstructor); |
| 102 Expect.isTrue(mm.isRedirectingConstructor); | 101 Expect.isTrue(mm.isRedirectingConstructor); |
| 103 Expect.isTrue(mm.isConstConstructor); | 102 Expect.isTrue(mm.isConstConstructor); |
| 104 } | 103 } |
| OLD | NEW |