OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library engine.testing.test_type_provider; | 8 library engine.testing.test_type_provider; |
9 | 9 |
| 10 import 'package:analyzer/src/generated/ast.dart'; |
10 import 'package:analyzer/src/generated/constant.dart'; | 11 import 'package:analyzer/src/generated/constant.dart'; |
11 import 'package:analyzer/src/generated/element.dart'; | 12 import 'package:analyzer/src/generated/element.dart'; |
12 import 'package:analyzer/src/generated/resolver.dart'; | 13 import 'package:analyzer/src/generated/resolver.dart'; |
| 14 import 'package:analyzer/src/generated/scanner.dart'; |
| 15 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
13 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 16 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
| 17 import 'package:analyzer/src/generated/testing/token_factory.dart'; |
14 | 18 |
15 /** | 19 /** |
16 * A type provider that can be used by tests without creating the element model | 20 * A type provider that can be used by tests without creating the element model |
17 * for the core library. | 21 * for the core library. |
18 */ | 22 */ |
19 class TestTypeProvider implements TypeProvider { | 23 class TestTypeProvider implements TypeProvider { |
20 /** | 24 /** |
21 * The type representing the built-in type 'bool'. | 25 * The type representing the built-in type 'bool'. |
22 */ | 26 */ |
23 InterfaceType _boolType; | 27 InterfaceType _boolType; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 _bottomType = BottomTypeImpl.instance; | 175 _bottomType = BottomTypeImpl.instance; |
172 } | 176 } |
173 return _bottomType; | 177 return _bottomType; |
174 } | 178 } |
175 | 179 |
176 @override | 180 @override |
177 InterfaceType get deprecatedType { | 181 InterfaceType get deprecatedType { |
178 if (_deprecatedType == null) { | 182 if (_deprecatedType == null) { |
179 ClassElementImpl deprecatedElement = | 183 ClassElementImpl deprecatedElement = |
180 ElementFactory.classElement2("Deprecated"); | 184 ElementFactory.classElement2("Deprecated"); |
181 deprecatedElement.constructors = <ConstructorElement>[ | 185 ConstructorElementImpl constructor = ElementFactory.constructorElement( |
182 ElementFactory.constructorElement( | 186 deprecatedElement, null, true, [stringType]); |
183 deprecatedElement, null, true, [stringType]) | 187 constructor.constantInitializers = <ConstructorInitializer>[ |
| 188 AstFactory.constructorFieldInitializer( |
| 189 true, 'expires', AstFactory.identifier3('expires')) |
184 ]; | 190 ]; |
| 191 deprecatedElement.constructors = <ConstructorElement>[constructor]; |
185 _deprecatedType = deprecatedElement.type; | 192 _deprecatedType = deprecatedElement.type; |
186 } | 193 } |
187 return _deprecatedType; | 194 return _deprecatedType; |
188 } | 195 } |
189 | 196 |
190 @override | 197 @override |
191 InterfaceType get doubleType { | 198 InterfaceType get doubleType { |
192 if (_doubleType == null) { | 199 if (_doubleType == null) { |
193 _initializeNumericTypes(); | 200 _initializeNumericTypes(); |
194 } | 201 } |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 _initializeNumericTypes(); | 369 _initializeNumericTypes(); |
363 } | 370 } |
364 return _numType; | 371 return _numType; |
365 } | 372 } |
366 | 373 |
367 @override | 374 @override |
368 InterfaceType get objectType { | 375 InterfaceType get objectType { |
369 if (_objectType == null) { | 376 if (_objectType == null) { |
370 ClassElementImpl objectElement = ElementFactory.object; | 377 ClassElementImpl objectElement = ElementFactory.object; |
371 _objectType = objectElement.type; | 378 _objectType = objectElement.type; |
372 objectElement.constructors = <ConstructorElement>[ | 379 ConstructorElementImpl constructor = |
373 ElementFactory.constructorElement2(objectElement, null) | 380 ElementFactory.constructorElement(objectElement, null, true); |
374 ]; | 381 constructor.constantInitializers = <ConstructorInitializer>[]; |
| 382 objectElement.constructors = <ConstructorElement>[constructor]; |
375 objectElement.methods = <MethodElement>[ | 383 objectElement.methods = <MethodElement>[ |
376 ElementFactory.methodElement("toString", stringType), | 384 ElementFactory.methodElement("toString", stringType), |
377 ElementFactory.methodElement("==", boolType, [_objectType]), | 385 ElementFactory.methodElement("==", boolType, [_objectType]), |
378 ElementFactory.methodElement("noSuchMethod", dynamicType, [dynamicType]) | 386 ElementFactory.methodElement("noSuchMethod", dynamicType, [dynamicType]) |
379 ]; | 387 ]; |
380 _setAccessors(objectElement, <PropertyAccessorElement>[ | 388 _setAccessors(objectElement, <PropertyAccessorElement>[ |
381 ElementFactory.getterElement("hashCode", false, intType), | 389 ElementFactory.getterElement("hashCode", false, intType), |
382 ElementFactory.getterElement("runtimeType", false, typeType) | 390 ElementFactory.getterElement("runtimeType", false, typeType) |
383 ]); | 391 ]); |
384 } | 392 } |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 * and also set the fields to those that correspond to the accessors. | 617 * and also set the fields to those that correspond to the accessors. |
610 */ | 618 */ |
611 void _setAccessors( | 619 void _setAccessors( |
612 ClassElementImpl element, List<PropertyAccessorElement> accessors) { | 620 ClassElementImpl element, List<PropertyAccessorElement> accessors) { |
613 element.accessors = accessors; | 621 element.accessors = accessors; |
614 element.fields = accessors | 622 element.fields = accessors |
615 .map((PropertyAccessorElement accessor) => accessor.variable) | 623 .map((PropertyAccessorElement accessor) => accessor.variable) |
616 .toList(); | 624 .toList(); |
617 } | 625 } |
618 } | 626 } |
OLD | NEW |