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();
|
elementary = parseElementaryOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
Assignment assignment =
|
Assignment assignment;
|
||||||
createWithLocation<Assignment>(std::get<Identifier>(elementary).location);
|
assignment.location = std::get<Identifier>(elementary).location;
|
||||||
assignment.variableNames = std::move(variableNames);
|
assignment.variableNames = std::move(variableNames);
|
||||||
|
|
||||||
expectToken(Token::AssemblyAssign);
|
expectToken(Token::AssemblyAssign);
|
||||||
|
@ -60,18 +60,11 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
using ElementaryOperation = std::variant<Literal, Identifier, FunctionCall>;
|
using ElementaryOperation = std::variant<Literal, Identifier, FunctionCall>;
|
||||||
|
|
||||||
/// Creates an inline assembly node with the given source location.
|
/// Creates an inline assembly node with the current source location.
|
||||||
template <class T> T createWithLocation(langutil::SourceLocation const& _loc = {}) const
|
template <class T> T createWithLocation() const
|
||||||
{
|
{
|
||||||
T r;
|
T r;
|
||||||
r.location = _loc;
|
r.location = location();
|
||||||
if (!r.location.hasText())
|
|
||||||
{
|
|
||||||
r.location.start = position();
|
|
||||||
r.location.end = endPosition();
|
|
||||||
}
|
|
||||||
if (!r.location.source)
|
|
||||||
r.location.source = m_scanner->charStream();
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
langutil::SourceLocation location() const { return {position(), endPosition(), m_scanner->charStream()}; }
|
langutil::SourceLocation location() const { return {position(), endPosition(), m_scanner->charStream()}; }
|
||||||
|
Loading…
Reference in New Issue
Block a user