liblangutil: small refactors wrt. API cleanups

Especially also remove SourceLocation ctor's that the compiler can default-implement.
This commit is contained in:
Christian Parpart 2018-11-30 13:34:44 +01:00
parent 435f7b3b72
commit 18e3d6dbca
No known key found for this signature in database
GPG Key ID: 19BC8DD20312C929
3 changed files with 2 additions and 16 deletions

View File

@ -80,7 +80,7 @@ public:
void reset() { m_position = 0; } void reset() { m_position = 0; }
std::string const& source() const { return m_source; } std::string const& source() const noexcept { return m_source; }
std::string const& name() const noexcept { return m_name; } std::string const& name() const noexcept { return m_name; }
///@{ ///@{

View File

@ -93,7 +93,7 @@ public:
explicit Scanner(std::shared_ptr<CharStream> _source) { reset(std::move(_source)); } explicit Scanner(std::shared_ptr<CharStream> _source) { reset(std::move(_source)); }
explicit Scanner(CharStream _source = CharStream()) { reset(std::move(_source)); } explicit Scanner(CharStream _source = CharStream()) { reset(std::move(_source)); }
std::string source() const { return m_source->source(); } std::string const& source() const noexcept { return m_source->source(); }
std::shared_ptr<CharStream> charStream() noexcept { return m_source; } std::shared_ptr<CharStream> charStream() noexcept { return m_source; }

View File

@ -41,20 +41,6 @@ struct SourceLocation
SourceLocation(): start(-1), end(-1), source{nullptr} { } SourceLocation(): start(-1), end(-1), source{nullptr} { }
SourceLocation(int _start, int _end, std::shared_ptr<CharStream> _source): SourceLocation(int _start, int _end, std::shared_ptr<CharStream> _source):
start(_start), end(_end), source{std::move(_source)} { } start(_start), end(_end), source{std::move(_source)} { }
SourceLocation(SourceLocation&& _other) noexcept:
start(_other.start),
end(_other.end),
source{std::move(_other.source)}
{}
SourceLocation(SourceLocation const&) = default;
SourceLocation& operator=(SourceLocation const&) = default;
SourceLocation& operator=(SourceLocation&& _other) noexcept
{
start = _other.start;
end = _other.end;
source = std::move(_other.source);
return *this;
}
bool operator==(SourceLocation const& _other) const bool operator==(SourceLocation const& _other) const
{ {