| 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.test.generated.test_support; | 5 library analyzer.test.generated.test_support; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart' show AstNode, SimpleIdentifier; | 9 import 'package:analyzer/dart/ast/ast.dart' show AstNode, SimpleIdentifier; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 * Set the line information associated with the given source to the given info
rmation. | 409 * Set the line information associated with the given source to the given info
rmation. |
| 410 * | 410 * |
| 411 * @param source the source with which the line information is associated | 411 * @param source the source with which the line information is associated |
| 412 * @param lineStarts the line start information to be associated with the sour
ce | 412 * @param lineStarts the line start information to be associated with the sour
ce |
| 413 */ | 413 */ |
| 414 void setLineInfo(Source source, List<int> lineStarts) { | 414 void setLineInfo(Source source, List<int> lineStarts) { |
| 415 _lineInfoMap[source] = new LineInfo(lineStarts); | 415 _lineInfoMap[source] = new LineInfo(lineStarts); |
| 416 } | 416 } |
| 417 | 417 |
| 418 /** | 418 /** |
| 419 * Return `true` if the two errors are equivalent. | 419 * Return `true` if the [actualError] matches the [expectedError]. |
| 420 * | |
| 421 * @param firstError the first error being compared | |
| 422 * @param secondError the second error being compared | |
| 423 * @return `true` if the two errors are equivalent | |
| 424 */ | 420 */ |
| 425 bool _equalErrors(AnalysisError firstError, AnalysisError secondError) => | 421 bool _equalErrors(AnalysisError expectedError, AnalysisError actualError) { |
| 426 identical(firstError.errorCode, secondError.errorCode) && | 422 Source expectedSource = expectedError.source; |
| 427 firstError.offset == secondError.offset && | 423 return identical(expectedError.errorCode, actualError.errorCode) && |
| 428 firstError.length == secondError.length && | 424 expectedError.offset == actualError.offset && |
| 429 _equalSources(firstError.source, secondError.source); | 425 expectedError.length == actualError.length && |
| 426 (expectedSource == null || |
| 427 _equalSources(expectedSource, actualError.source)); |
| 428 } |
| 430 | 429 |
| 431 /** | 430 /** |
| 432 * Return `true` if the two sources are equivalent. | 431 * Return `true` if the two sources are equivalent. |
| 433 * | 432 * |
| 434 * @param firstSource the first source being compared | 433 * @param firstSource the first source being compared |
| 435 * @param secondSource the second source being compared | 434 * @param secondSource the second source being compared |
| 436 * @return `true` if the two sources are equivalent | 435 * @return `true` if the two sources are equivalent |
| 437 */ | 436 */ |
| 438 bool _equalSources(Source firstSource, Source secondSource) { | 437 bool _equalSources(Source firstSource, Source secondSource) { |
| 439 if (firstSource == null) { | 438 if (firstSource == null) { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 return UriKind.FILE_URI; | 637 return UriKind.FILE_URI; |
| 639 } | 638 } |
| 640 | 639 |
| 641 bool operator ==(Object other) { | 640 bool operator ==(Object other) { |
| 642 if (other is TestSource) { | 641 if (other is TestSource) { |
| 643 return other.uri == uri; | 642 return other.uri == uri; |
| 644 } | 643 } |
| 645 return false; | 644 return false; |
| 646 } | 645 } |
| 647 } | 646 } |
| OLD | NEW |