mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-31 18:00:26 +00:00
Fix some more operator< implementations. This may fix some of the IndexUpdate diff issues.
This commit is contained in:
parent
57da6a81ab
commit
a587022643
@ -88,7 +88,9 @@ struct Ref {
|
||||
}
|
||||
bool operator!=(const Ref<T>& other) { return !(*this == other); }
|
||||
bool operator<(const Ref<T>& other) const {
|
||||
return id_ < other.id && loc < other.loc;
|
||||
if (id_ < other.id)
|
||||
return true;
|
||||
return id_ == other.id && loc < other.loc;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -134,5 +134,7 @@ bool Range::operator==(const Range& that) const {
|
||||
bool Range::operator!=(const Range& that) const { return !(*this == that); }
|
||||
|
||||
bool Range::operator<(const Range& that) const {
|
||||
return start < that.start;// || end < that.end;
|
||||
if (start < that.start)
|
||||
return true;
|
||||
return start == that.start && end < that.end;
|
||||
}
|
14
src/query.h
14
src/query.h
@ -53,9 +53,9 @@ struct QueryLocation {
|
||||
}
|
||||
bool operator!=(const QueryLocation& other) const { return !(*this == other); }
|
||||
bool operator<(const QueryLocation& o) const {
|
||||
return
|
||||
path < o.path &&
|
||||
range < o.range;
|
||||
if (path < o.path)
|
||||
return true;
|
||||
return path == o.path && range < o.range;
|
||||
}
|
||||
};
|
||||
|
||||
@ -72,7 +72,9 @@ struct SymbolIdx {
|
||||
}
|
||||
bool operator!=(const SymbolIdx& that) const { return !(*this == that); }
|
||||
bool operator<(const SymbolIdx& that) const {
|
||||
return kind < that.kind || idx < that.idx;
|
||||
if (kind < that.kind)
|
||||
return true;
|
||||
return kind == that.kind && idx < that.idx;
|
||||
}
|
||||
};
|
||||
|
||||
@ -87,7 +89,9 @@ struct SymbolRef {
|
||||
}
|
||||
bool operator!=(const SymbolRef& that) const { return !(*this == that); }
|
||||
bool operator<(const SymbolRef& that) const {
|
||||
return idx < that.idx && loc.range.start < that.loc.range.start;
|
||||
if (idx < that.idx)
|
||||
return true;
|
||||
return idx == that.idx && loc.range.start < that.loc.range.start;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user