Use VersionConstraint in SdkConstraintVerifier.

R=brianwilkerson@google.com

Change-Id: I458c717ca3d7c51797e3da9ea5cfac4816f4d789
Reviewed-on: https://dart-review.googlesource.com/c/86720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2018-12-08 18:12:48 +00:00 committed by commit-bot@chromium.org
parent c1a0c611c3
commit 3d6d1d1755

View file

@ -23,8 +23,8 @@ class SdkConstraintVerifier extends RecursiveAstVisitor<void> {
/// The typ provider used to access SDK types.
final TypeProvider _typeProvider;
/// The range of versions of the SDK that are allowed by the SDK constraints.
final VersionRange _versionRange;
/// The version constraint for the SDK.
final VersionConstraint _versionConstraint;
/// A cached flag indicating whether references to Future and Stream need to
/// be checked. Use [] to access this field.
@ -33,15 +33,15 @@ class SdkConstraintVerifier extends RecursiveAstVisitor<void> {
/// Initialize a newly created verifier to use the given [_errorReporter] to
/// report errors.
SdkConstraintVerifier(this._errorReporter, this._containingLibrary,
this._typeProvider, this._versionRange);
this._typeProvider, this._versionConstraint);
/// Return a range covering every version up to, but not including, 2.1.0.
VersionRange get before_2_1_0 =>
new VersionRange(max: Version.parse('2.1.0'), includeMax: false);
/// Return `true` if references to Future and Stream need to be checked.
bool get checkFutureAndStream =>
_checkFutureAndStream ??= !before_2_1_0.intersect(_versionRange).isEmpty;
bool get checkFutureAndStream => _checkFutureAndStream ??=
!before_2_1_0.intersect(_versionConstraint).isEmpty;
@override
void visitHideCombinator(HideCombinator node) {