mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[isoltest] Add support for builtin functions.
This commit is contained in:
@@ -55,7 +55,7 @@ vector<solidity::frontend::test::FunctionCall> TestFileParser::parseFunctionCall
|
||||
vector<FunctionCall> calls;
|
||||
if (!accept(Token::EOS))
|
||||
{
|
||||
assert(m_scanner.currentToken() == Token::Unknown);
|
||||
soltestAssert(m_scanner.currentToken() == Token::Unknown, "");
|
||||
m_scanner.scanNextToken();
|
||||
|
||||
while (!accept(Token::EOS))
|
||||
@@ -106,6 +106,8 @@ vector<solidity::frontend::test::FunctionCall> TestFileParser::parseFunctionCall
|
||||
tie(call.signature, lowLevelCall) = parseFunctionSignature();
|
||||
if (lowLevelCall)
|
||||
call.kind = FunctionCall::Kind::LowLevel;
|
||||
else if (isBuiltinFunction(call.signature))
|
||||
call.kind = FunctionCall::Kind::Builtin;
|
||||
|
||||
if (accept(Token::Comma, true))
|
||||
call.value = parseFunctionCallValue();
|
||||
@@ -195,6 +197,9 @@ pair<string, bool> TestFileParser::parseFunctionSignature()
|
||||
expect(Token::Identifier);
|
||||
}
|
||||
|
||||
if (isBuiltinFunction(signature))
|
||||
return {signature, false};
|
||||
|
||||
signature += formatToken(Token::LParen);
|
||||
expect(Token::LParen);
|
||||
|
||||
@@ -488,7 +493,7 @@ void TestFileParser::Scanner::readStream(istream& _stream)
|
||||
void TestFileParser::Scanner::scanNextToken()
|
||||
{
|
||||
// Make code coverage happy.
|
||||
assert(formatToken(Token::NUM_TOKENS) == "");
|
||||
soltestAssert(formatToken(Token::NUM_TOKENS).empty(), "");
|
||||
|
||||
auto detectKeyword = [](std::string const& _literal = "") -> std::pair<Token, std::string> {
|
||||
if (_literal == "true") return {Token::Boolean, "true"};
|
||||
@@ -712,3 +717,8 @@ char TestFileParser::Scanner::scanHexPart()
|
||||
|
||||
return static_cast<char>(value);
|
||||
}
|
||||
|
||||
bool TestFileParser::isBuiltinFunction(std::string const& signature)
|
||||
{
|
||||
return m_builtins.count(signature) > 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user