| 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   new ClassWithDefaultConstructor();  /// 01: ok | 35   new ClassWithDefaultConstructor();  /// 01: ok | 
| 36   new Class.generativeConstructor();  /// 01: ok | 36   new Class.generativeConstructor();  /// 01: ok | 
| 37   new Class.redirectingGenerativeConstructor();  /// 01: ok | 37   new Class.redirectingGenerativeConstructor();  /// 01: ok | 
| 38   new Class.factoryConstructor();  /// 01: ok | 38   new Class.factoryConstructor();  /// 01: ok | 
| 39   new Class.redirectingFactoryConstructor();  /// 01: ok | 39   new Class.redirectingFactoryConstructor();  /// 01: ok | 
| 40   const Class.constGenerativeConstructor();  /// 01: ok | 40   const Class.constGenerativeConstructor();  /// 01: ok | 
| 41   const Class.constRedirectingGenerativeConstructor();  /// 01: ok | 41   const Class.constRedirectingGenerativeConstructor();  /// 01: ok | 
| 42   const Class.constRedirectingFactoryConstructor();  /// 01: ok | 42   const Class.constRedirectingFactoryConstructor();  /// 01: ok | 
| 43 | 43 | 
| 44   cm = reflectClass(ClassWithDefaultConstructor); | 44   cm = reflectClass(ClassWithDefaultConstructor); | 
| 45   mm = cm.declarations.values | 45   mm = cm.constructors.values.single; | 
| 46       .where((d) => d is MethodMirror && d.isConstructor).single; |  | 
| 47   Expect.isTrue(mm.isConstructor); | 46   Expect.isTrue(mm.isConstructor); | 
| 48   Expect.isTrue(mm.isGenerativeConstructor); | 47   Expect.isTrue(mm.isGenerativeConstructor); | 
| 49   Expect.isFalse(mm.isFactoryConstructor); | 48   Expect.isFalse(mm.isFactoryConstructor); | 
| 50   Expect.isFalse(mm.isRedirectingConstructor); | 49   Expect.isFalse(mm.isRedirectingConstructor); | 
| 51   Expect.isFalse(mm.isConstConstructor); | 50   Expect.isFalse(mm.isConstConstructor); | 
| 52 | 51 | 
| 53   cm = reflectClass(Class); | 52   cm = reflectClass(Class); | 
| 54 | 53 | 
| 55   mm = cm.declarations[#Class.generativeConstructor]; | 54   mm = cm.constructors[#Class.generativeConstructor]; | 
| 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.isFalse(mm.isRedirectingConstructor); | 58   Expect.isFalse(mm.isRedirectingConstructor); | 
| 60   Expect.isFalse(mm.isConstConstructor); | 59   Expect.isFalse(mm.isConstConstructor); | 
| 61 | 60 | 
| 62   mm = cm.declarations[#Class.redirectingGenerativeConstructor]; | 61   mm = cm.constructors[#Class.redirectingGenerativeConstructor]; | 
| 63   Expect.isTrue(mm.isConstructor); | 62   Expect.isTrue(mm.isConstructor); | 
| 64   Expect.isTrue(mm.isGenerativeConstructor); | 63   Expect.isTrue(mm.isGenerativeConstructor); | 
| 65   Expect.isFalse(mm.isFactoryConstructor); | 64   Expect.isFalse(mm.isFactoryConstructor); | 
| 66   Expect.isTrue(mm.isRedirectingConstructor); | 65   Expect.isTrue(mm.isRedirectingConstructor); | 
| 67   Expect.isFalse(mm.isConstConstructor); | 66   Expect.isFalse(mm.isConstConstructor); | 
| 68 | 67 | 
| 69   mm = cm.declarations[#Class.factoryConstructor]; | 68   mm = cm.constructors[#Class.factoryConstructor]; | 
| 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.isFalse(mm.isRedirectingConstructor); | 72   Expect.isFalse(mm.isRedirectingConstructor); | 
| 74   Expect.isFalse(mm.isConstConstructor); | 73   Expect.isFalse(mm.isConstConstructor); | 
| 75 | 74 | 
| 76   mm = cm.declarations[#Class.redirectingFactoryConstructor]; | 75   mm = cm.constructors[#Class.redirectingFactoryConstructor]; | 
| 77   Expect.isTrue(mm.isConstructor); | 76   Expect.isTrue(mm.isConstructor); | 
| 78   Expect.isFalse(mm.isGenerativeConstructor); | 77   Expect.isFalse(mm.isGenerativeConstructor); | 
| 79   Expect.isTrue(mm.isFactoryConstructor); | 78   Expect.isTrue(mm.isFactoryConstructor); | 
| 80   Expect.isTrue(mm.isRedirectingConstructor); | 79   Expect.isTrue(mm.isRedirectingConstructor); | 
| 81   Expect.isFalse(mm.isConstConstructor); | 80   Expect.isFalse(mm.isConstConstructor); | 
| 82 | 81 | 
| 83   mm = cm.declarations[#Class.constGenerativeConstructor]; | 82   mm = cm.constructors[#Class.constGenerativeConstructor]; | 
| 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.isFalse(mm.isRedirectingConstructor); | 86   Expect.isFalse(mm.isRedirectingConstructor); | 
| 88   Expect.isTrue(mm.isConstConstructor); | 87   Expect.isTrue(mm.isConstConstructor); | 
| 89 | 88 | 
| 90   mm = cm.declarations[#Class.constRedirectingGenerativeConstructor]; | 89   mm = cm.constructors[#Class.constRedirectingGenerativeConstructor]; | 
| 91   Expect.isTrue(mm.isConstructor); | 90   Expect.isTrue(mm.isConstructor); | 
| 92   Expect.isTrue(mm.isGenerativeConstructor); | 91   Expect.isTrue(mm.isGenerativeConstructor); | 
| 93   Expect.isFalse(mm.isFactoryConstructor); | 92   Expect.isFalse(mm.isFactoryConstructor); | 
| 94   Expect.isTrue(mm.isRedirectingConstructor); | 93   Expect.isTrue(mm.isRedirectingConstructor); | 
| 95   Expect.isTrue(mm.isConstConstructor); | 94   Expect.isTrue(mm.isConstConstructor); | 
| 96 | 95 | 
| 97   // Not legal. | 96   // Not legal. | 
| 98   // mm = cm.declarations[#Class.constFactoryConstructor]; | 97   // mm = cm.constructors[#Class.constFactoryConstructor]; | 
| 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.isFalse(mm.isRedirectingConstructor); | 101   // Expect.isFalse(mm.isRedirectingConstructor); | 
| 103   // Expect.isTrue(mm.isConstConstructor); | 102   // Expect.isTrue(mm.isConstConstructor); | 
| 104 | 103 | 
| 105   mm = cm.declarations[#Class.constRedirectingFactoryConstructor]; | 104   mm = cm.constructors[#Class.constRedirectingFactoryConstructor]; | 
| 106   Expect.isTrue(mm.isConstructor); | 105   Expect.isTrue(mm.isConstructor); | 
| 107   Expect.isFalse(mm.isGenerativeConstructor); | 106   Expect.isFalse(mm.isGenerativeConstructor); | 
| 108   Expect.isTrue(mm.isFactoryConstructor); | 107   Expect.isTrue(mm.isFactoryConstructor); | 
| 109   Expect.isTrue(mm.isRedirectingConstructor); | 108   Expect.isTrue(mm.isRedirectingConstructor); | 
| 110   Expect.isTrue(mm.isConstConstructor); | 109   Expect.isTrue(mm.isConstConstructor); | 
| 111 } | 110 } | 
| OLD | NEW | 
|---|