mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Simplified Parser::createWithLocation().
In all but one case the function was called with the default argument value. And when it was location, the location should be valid (see Parser::parseElementaryOperation()).
This commit is contained in:
parent
dd7a5c3386
commit
7fecab07a8
@ -206,8 +206,8 @@ Statement Parser::parseStatement()
|
||||
elementary = parseElementaryOperation();
|
||||
}
|
||||
|
||||
Assignment assignment =
|
||||
createWithLocation<Assignment>(std::get<Identifier>(elementary).location);
|
||||
Assignment assignment;
|
||||
assignment.location = std::get<Identifier>(elementary).location;
|
||||
assignment.variableNames = std::move(variableNames);
|
||||
|
||||
expectToken(Token::AssemblyAssign);
|
||||
|
@ -60,18 +60,11 @@ public:
|
||||
protected:
|
||||
using ElementaryOperation = std::variant<Literal, Identifier, FunctionCall>;
|
||||
|
||||
/// Creates an inline assembly node with the given source location.
|
||||
template <class T> T createWithLocation(langutil::SourceLocation const& _loc = {}) const
|
||||
/// Creates an inline assembly node with the current source location.
|
||||
template <class T> T createWithLocation() const
|
||||
{
|
||||
T r;
|
||||
r.location = _loc;
|
||||
if (!r.location.hasText())
|
||||
{
|
||||
r.location.start = position();
|
||||
r.location.end = endPosition();
|
||||
}
|
||||
if (!r.location.source)
|
||||
r.location.source = m_scanner->charStream();
|
||||
r.location = location();
|
||||
return r;
|
||||
}
|
||||
langutil::SourceLocation location() const { return {position(), endPosition(), m_scanner->charStream()}; }
|
||||
|
Loading…
Reference in New Issue
Block a user