mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
liblangutil: SourceLocation to default initialize data members (w/o the use of ctor)
See: http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c45-dont-define-a-default-constructor-that-only-initializes-data-members-use-in-class-member-initializers-instead
This commit is contained in:
@@ -100,10 +100,10 @@ void ParserBase::decreaseRecursionDepth()
|
||||
|
||||
void ParserBase::parserError(string const& _description)
|
||||
{
|
||||
m_errorReporter.parserError(SourceLocation(position(), endPosition(), source()), _description);
|
||||
m_errorReporter.parserError(SourceLocation{position(), endPosition(), source()}, _description);
|
||||
}
|
||||
|
||||
void ParserBase::fatalParserError(string const& _description)
|
||||
{
|
||||
m_errorReporter.fatalParserError(SourceLocation(position(), endPosition(), source()), _description);
|
||||
m_errorReporter.fatalParserError(SourceLocation{position(), endPosition(), source()}, _description);
|
||||
}
|
||||
|
||||
@@ -38,10 +38,6 @@ namespace langutil
|
||||
*/
|
||||
struct SourceLocation
|
||||
{
|
||||
SourceLocation(): start(-1), end(-1), source{nullptr} { }
|
||||
SourceLocation(int _start, int _end, std::shared_ptr<CharStream> _source):
|
||||
start(_start), end(_end), source{std::move(_source)} { }
|
||||
|
||||
bool operator==(SourceLocation const& _other) const
|
||||
{
|
||||
return source.get() == _other.source.get() && start == _other.start && end == _other.end;
|
||||
@@ -53,8 +49,8 @@ struct SourceLocation
|
||||
|
||||
bool isEmpty() const { return start == -1 && end == -1; }
|
||||
|
||||
int start;
|
||||
int end;
|
||||
int start = -1;
|
||||
int end = -1;
|
||||
std::shared_ptr<CharStream> source;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user