diff options
author | Christian Parpart <christian@ethereum.org> | 2018-12-01 00:34:54 +0800 |
---|---|---|
committer | Christian Parpart <christian@ethereum.org> | 2018-12-01 00:34:54 +0800 |
commit | 757623e381aba24b81a2365cf19037d3d96bf945 (patch) | |
tree | 15f7f3467df5464cb2b26583628d672091b1c590 /liblangutil | |
parent | 18e3d6dbca1250cdc36119c3da8328338fe9f1f6 (diff) | |
download | dexon-solidity-757623e381aba24b81a2365cf19037d3d96bf945.tar.gz dexon-solidity-757623e381aba24b81a2365cf19037d3d96bf945.tar.zst dexon-solidity-757623e381aba24b81a2365cf19037d3d96bf945.zip |
liblangutil: SourceLocation: Retricts == and != operator
Diffstat (limited to 'liblangutil')
-rw-r--r-- | liblangutil/SourceLocation.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/liblangutil/SourceLocation.h b/liblangutil/SourceLocation.h index 732a32e1..2d18a7d1 100644 --- a/liblangutil/SourceLocation.h +++ b/liblangutil/SourceLocation.h @@ -44,9 +44,7 @@ struct SourceLocation bool operator==(SourceLocation const& _other) const { - return start == _other.start && end == _other.end && - ((!source.get() && !_other.source.get()) || - (source.get() && _other.source.get() && source->name() == _other.source->name())); + return source.get() == _other.source.get() && start == _other.start && end == _other.end; } bool operator!=(SourceLocation const& _other) const { return !operator==(_other); } inline bool operator<(SourceLocation const& _other) const; @@ -84,14 +82,14 @@ bool SourceLocation::operator<(SourceLocation const& _other) const bool SourceLocation::contains(SourceLocation const& _other) const { - if (isEmpty() || _other.isEmpty() || ((!source || !_other.source || source->name() != _other.source->name()) && (source || _other.source))) + if (isEmpty() || _other.isEmpty() || source.get() != _other.source.get()) return false; return start <= _other.start && _other.end <= end; } bool SourceLocation::intersects(SourceLocation const& _other) const { - if (isEmpty() || _other.isEmpty() || ((!source || !_other.source || source->name() != _other.source->name()) && (source || _other.source))) + if (isEmpty() || _other.isEmpty() || source.get() != _other.source.get()) return false; return _other.start < end && start < _other.end; } |