| 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 analyzer.test.utils; | 5 library analyzer.test.utils; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 | 196 |
| 197 /** | 197 /** |
| 198 * Class for compositionally building up assertions on types | 198 * Class for compositionally building up assertions on types |
| 199 */ | 199 */ |
| 200 class TypeAssertions { | 200 class TypeAssertions { |
| 201 // TODO(leafp): Make these matchers. | 201 // TODO(leafp): Make these matchers. |
| 202 // https://www.dartdocs.org/documentation/matcher/0.12.0%2B1/matcher/Matcher-c
lass.html | 202 // https://www.dartdocs.org/documentation/matcher/0.12.0%2B1/matcher/Matcher-c
lass.html |
| 203 | 203 |
| 204 /* Provides primitive types for basic type assertions */ | 204 /** |
| 205 * Provides primitive types for basic type assertions. |
| 206 */ |
| 205 final TypeProvider _typeProvider; | 207 final TypeProvider _typeProvider; |
| 206 | 208 |
| 207 TypeAssertions(this._typeProvider); | 209 TypeAssertions(this._typeProvider); |
| 208 | 210 |
| 209 /** | 211 /** |
| 210 * Primitive assertion for the dynamic type | 212 * Primitive assertion for the dynamic type |
| 211 */ | 213 */ |
| 212 Asserter<DartType> get isDynamic => isType(_typeProvider.dynamicType); | 214 Asserter<DartType> get isDynamic => isType(_typeProvider.dynamicType); |
| 213 | 215 |
| 214 /** | 216 /** |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 Asserter<DartType> isType(DartType argument) => (DartType t) { | 293 Asserter<DartType> isType(DartType argument) => (DartType t) { |
| 292 expect(t, same(argument)); | 294 expect(t, same(argument)); |
| 293 }; | 295 }; |
| 294 | 296 |
| 295 /** | 297 /** |
| 296 * Given a type, produce an assertion that a type has the same element. | 298 * Given a type, produce an assertion that a type has the same element. |
| 297 */ | 299 */ |
| 298 Asserter<DartType> sameElement(DartType elementType) => | 300 Asserter<DartType> sameElement(DartType elementType) => |
| 299 hasElement(elementType.element); | 301 hasElement(elementType.element); |
| 300 } | 302 } |
| OLD | NEW |