mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
libyul: Small code improvements.
This commit is contained in:
parent
2890e4888f
commit
f45c3124f8
@ -276,9 +276,7 @@ Expression Parser::parseExpression()
|
||||
RecursionGuard recursionGuard(*this);
|
||||
|
||||
ElementaryOperation operation = parseElementaryOperation();
|
||||
if (operation.type() == typeid(FunctionCall))
|
||||
return parseCall(std::move(operation));
|
||||
else if (currentToken() == Token::LParen)
|
||||
if (operation.type() == typeid(FunctionCall) || currentToken() == Token::LParen)
|
||||
return parseCall(std::move(operation));
|
||||
else if (operation.type() == typeid(Identifier))
|
||||
return boost::get<Identifier>(operation);
|
||||
@ -316,7 +314,6 @@ Parser::ElementaryOperation Parser::parseElementaryOperation()
|
||||
case Token::Address:
|
||||
{
|
||||
YulString literal{currentLiteral()};
|
||||
// first search the set of builtins, then the instructions.
|
||||
if (m_dialect.builtin(literal))
|
||||
{
|
||||
Identifier identifier{location(), literal};
|
||||
|
@ -54,7 +54,6 @@ Dialect const& languageToDialect(AssemblyStack::Language _language, EVMVersion _
|
||||
switch (_language)
|
||||
{
|
||||
case AssemblyStack::Language::Assembly:
|
||||
return EVMDialect::strictAssemblyForEVM(_version);
|
||||
case AssemblyStack::Language::StrictAssembly:
|
||||
return EVMDialect::strictAssemblyForEVMObjects(_version);
|
||||
case AssemblyStack::Language::Yul:
|
||||
@ -132,15 +131,19 @@ bool AssemblyStack::analyzeParsed(Object& _object)
|
||||
void AssemblyStack::compileEVM(AbstractAssembly& _assembly, bool _evm15, bool _optimize) const
|
||||
{
|
||||
EVMDialect const* dialect = nullptr;
|
||||
|
||||
if (m_language == Language::Assembly)
|
||||
dialect = &EVMDialect::strictAssemblyForEVM(m_evmVersion);
|
||||
else if (m_language == AssemblyStack::Language::StrictAssembly)
|
||||
dialect = &EVMDialect::strictAssemblyForEVMObjects(m_evmVersion);
|
||||
else if (m_language == AssemblyStack::Language::Yul)
|
||||
dialect = &EVMDialect::yulForEVM(m_evmVersion);
|
||||
else
|
||||
solAssert(false, "Invalid language.");
|
||||
switch (m_language)
|
||||
{
|
||||
case Language::Assembly:
|
||||
case Language::StrictAssembly:
|
||||
dialect = &EVMDialect::strictAssemblyForEVMObjects(m_evmVersion);
|
||||
break;
|
||||
case Language::Yul:
|
||||
dialect = &EVMDialect::yulForEVM(m_evmVersion);
|
||||
break;
|
||||
default:
|
||||
solAssert(false, "Invalid language.");
|
||||
break;
|
||||
}
|
||||
|
||||
EVMObjectCompiler::compile(*m_parserResult, _assembly, *dialect, _evm15, _optimize);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user