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 library analyzer.src.generated.incremental_resolution_validator; | 5 library analyzer.src.generated.incremental_resolution_validator; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.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'; |
11 import 'package:analyzer/src/dart/ast/utilities.dart'; | 11 import 'package:analyzer/src/dart/ast/utilities.dart'; |
12 import 'package:analyzer/src/dart/element/element.dart'; | 12 import 'package:analyzer/src/dart/element/element.dart'; |
13 import 'package:analyzer/src/dart/element/member.dart'; | 13 import 'package:analyzer/src/dart/element/member.dart'; |
14 | 14 |
15 /** | 15 /** |
16 * Validates that the [actual] and the [expected] units have the same structure | 16 * Validates that the [actual] and the [expected] units have the same structure |
17 * and resolution. Throws [IncrementalResolutionMismatch] otherwise. | 17 * and resolution. Throws [IncrementalResolutionMismatch] otherwise. |
18 */ | 18 */ |
19 void assertSameResolution(CompilationUnit actual, CompilationUnit expected, | 19 void assertSameResolution(CompilationUnit actual, CompilationUnit expected, |
20 {bool validateTypes: false}) { | 20 {bool validateTypes: false}) { |
21 _SameResolutionValidator validator = new _SameResolutionValidator(validateType
s); | 21 _SameResolutionValidator validator = |
| 22 new _SameResolutionValidator(validateTypes); |
22 validator.isEqualNodes(expected, actual); | 23 validator.isEqualNodes(expected, actual); |
23 } | 24 } |
24 | 25 |
25 /** | 26 /** |
26 * This exception is thrown when a mismatch between actual and expected AST | 27 * This exception is thrown when a mismatch between actual and expected AST |
27 * or resolution is found. | 28 * or resolution is found. |
28 */ | 29 */ |
29 class IncrementalResolutionMismatch { | 30 class IncrementalResolutionMismatch { |
30 final String message; | 31 final String message; |
31 IncrementalResolutionMismatch(this.message); | 32 IncrementalResolutionMismatch(this.message); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 * package:project/my_lib.dart -> my_lib.dart | 198 * package:project/my_lib.dart -> my_lib.dart |
198 */ | 199 */ |
199 static String _getShortElementLocationUri(String uri) { | 200 static String _getShortElementLocationUri(String uri) { |
200 int index = uri.lastIndexOf('/'); | 201 int index = uri.lastIndexOf('/'); |
201 if (index == -1) { | 202 if (index == -1) { |
202 return uri; | 203 return uri; |
203 } | 204 } |
204 return uri.substring(index + 1); | 205 return uri.substring(index + 1); |
205 } | 206 } |
206 } | 207 } |
OLD | NEW |