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);
|
RecursionGuard recursionGuard(*this);
|
||||||
|
|
||||||
ElementaryOperation operation = parseElementaryOperation();
|
ElementaryOperation operation = parseElementaryOperation();
|
||||||
if (operation.type() == typeid(FunctionCall))
|
if (operation.type() == typeid(FunctionCall) || currentToken() == Token::LParen)
|
||||||
return parseCall(std::move(operation));
|
|
||||||
else if (currentToken() == Token::LParen)
|
|
||||||
return parseCall(std::move(operation));
|
return parseCall(std::move(operation));
|
||||||
else if (operation.type() == typeid(Identifier))
|
else if (operation.type() == typeid(Identifier))
|
||||||
return boost::get<Identifier>(operation);
|
return boost::get<Identifier>(operation);
|
||||||
@ -316,7 +314,6 @@ Parser::ElementaryOperation Parser::parseElementaryOperation()
|
|||||||
case Token::Address:
|
case Token::Address:
|
||||||
{
|
{
|
||||||
YulString literal{currentLiteral()};
|
YulString literal{currentLiteral()};
|
||||||
// first search the set of builtins, then the instructions.
|
|
||||||
if (m_dialect.builtin(literal))
|
if (m_dialect.builtin(literal))
|
||||||
{
|
{
|
||||||
Identifier identifier{location(), literal};
|
Identifier identifier{location(), literal};
|
||||||
|
@ -54,7 +54,6 @@ Dialect const& languageToDialect(AssemblyStack::Language _language, EVMVersion _
|
|||||||
switch (_language)
|
switch (_language)
|
||||||
{
|
{
|
||||||
case AssemblyStack::Language::Assembly:
|
case AssemblyStack::Language::Assembly:
|
||||||
return EVMDialect::strictAssemblyForEVM(_version);
|
|
||||||
case AssemblyStack::Language::StrictAssembly:
|
case AssemblyStack::Language::StrictAssembly:
|
||||||
return EVMDialect::strictAssemblyForEVMObjects(_version);
|
return EVMDialect::strictAssemblyForEVMObjects(_version);
|
||||||
case AssemblyStack::Language::Yul:
|
case AssemblyStack::Language::Yul:
|
||||||
@ -132,15 +131,19 @@ bool AssemblyStack::analyzeParsed(Object& _object)
|
|||||||
void AssemblyStack::compileEVM(AbstractAssembly& _assembly, bool _evm15, bool _optimize) const
|
void AssemblyStack::compileEVM(AbstractAssembly& _assembly, bool _evm15, bool _optimize) const
|
||||||
{
|
{
|
||||||
EVMDialect const* dialect = nullptr;
|
EVMDialect const* dialect = nullptr;
|
||||||
|
switch (m_language)
|
||||||
if (m_language == Language::Assembly)
|
{
|
||||||
dialect = &EVMDialect::strictAssemblyForEVM(m_evmVersion);
|
case Language::Assembly:
|
||||||
else if (m_language == AssemblyStack::Language::StrictAssembly)
|
case Language::StrictAssembly:
|
||||||
dialect = &EVMDialect::strictAssemblyForEVMObjects(m_evmVersion);
|
dialect = &EVMDialect::strictAssemblyForEVMObjects(m_evmVersion);
|
||||||
else if (m_language == AssemblyStack::Language::Yul)
|
break;
|
||||||
dialect = &EVMDialect::yulForEVM(m_evmVersion);
|
case Language::Yul:
|
||||||
else
|
dialect = &EVMDialect::yulForEVM(m_evmVersion);
|
||||||
solAssert(false, "Invalid language.");
|
break;
|
||||||
|
default:
|
||||||
|
solAssert(false, "Invalid language.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
EVMObjectCompiler::compile(*m_parserResult, _assembly, *dialect, _evm15, _optimize);
|
EVMObjectCompiler::compile(*m_parserResult, _assembly, *dialect, _evm15, _optimize);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user