mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Untangle headers and namespaces in TestFileParser
This commit is contained in:
parent
41f5036507
commit
c002fcc39f
@ -36,11 +36,9 @@
|
||||
|
||||
using namespace solidity;
|
||||
using namespace solidity::util;
|
||||
using namespace solidity::langutil;
|
||||
using namespace solidity::frontend;
|
||||
using namespace solidity::frontend::test;
|
||||
using namespace std;
|
||||
using namespace soltest;
|
||||
|
||||
bytes BytesUtils::alignLeft(bytes _bytes)
|
||||
{
|
||||
|
@ -41,7 +41,6 @@ using namespace solidity::util;
|
||||
using namespace solidity::langutil;
|
||||
using namespace solidity::frontend::test;
|
||||
using namespace std;
|
||||
using namespace soltest;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <libsolutil/AnsiColorized.h>
|
||||
#include <libsolutil/CommonData.h>
|
||||
#include <libsolidity/ast/Types.h>
|
||||
|
||||
namespace solidity::frontend::test
|
||||
{
|
||||
|
@ -34,11 +34,11 @@
|
||||
#include <stdexcept>
|
||||
|
||||
using namespace solidity;
|
||||
using namespace solidity::langutil;
|
||||
using namespace solidity::frontend;
|
||||
using namespace solidity::frontend::test;
|
||||
using namespace std;
|
||||
using namespace soltest;
|
||||
|
||||
using Token = soltest::Token;
|
||||
|
||||
char TestFileParser::Scanner::peek() const noexcept
|
||||
{
|
||||
@ -158,7 +158,7 @@ vector<solidity::frontend::test::FunctionCall> TestFileParser::parseFunctionCall
|
||||
return calls;
|
||||
}
|
||||
|
||||
bool TestFileParser::accept(soltest::Token _token, bool const _expect)
|
||||
bool TestFileParser::accept(Token _token, bool const _expect)
|
||||
{
|
||||
if (m_scanner.currentToken() != _token)
|
||||
return false;
|
||||
@ -167,7 +167,7 @@ bool TestFileParser::accept(soltest::Token _token, bool const _expect)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestFileParser::expect(soltest::Token _token, bool const _advance)
|
||||
bool TestFileParser::expect(Token _token, bool const _advance)
|
||||
{
|
||||
if (m_scanner.currentToken() != _token || m_scanner.currentToken() == Token::Invalid)
|
||||
throw TestParserError(
|
||||
@ -484,8 +484,6 @@ void TestFileParser::Scanner::readStream(istream& _stream)
|
||||
|
||||
void TestFileParser::Scanner::scanNextToken()
|
||||
{
|
||||
using namespace langutil;
|
||||
|
||||
// Make code coverage happy.
|
||||
assert(formatToken(Token::NUM_TOKENS) == "");
|
||||
|
||||
@ -554,12 +552,12 @@ void TestFileParser::Scanner::scanNextToken()
|
||||
token = selectToken(Token::String, scanString());
|
||||
break;
|
||||
default:
|
||||
if (isIdentifierStart(current()))
|
||||
if (langutil::isIdentifierStart(current()))
|
||||
{
|
||||
TokenDesc detectedToken = detectKeyword(scanIdentifierOrKeyword());
|
||||
token = selectToken(detectedToken.first, detectedToken.second);
|
||||
}
|
||||
else if (isDecimalDigit(current()))
|
||||
else if (langutil::isDecimalDigit(current()))
|
||||
{
|
||||
if (current() == '0' && peek() == 'x')
|
||||
{
|
||||
@ -570,7 +568,7 @@ void TestFileParser::Scanner::scanNextToken()
|
||||
else
|
||||
token = selectToken(Token::Number, scanDecimalNumber());
|
||||
}
|
||||
else if (isWhiteSpace(current()))
|
||||
else if (langutil::isWhiteSpace(current()))
|
||||
token = selectToken(Token::Whitespace);
|
||||
else if (isEndOfLine())
|
||||
token = make_pair(Token::EOS, "EOS");
|
||||
|
@ -15,7 +15,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <libsolutil/CommonData.h>
|
||||
#include <libsolidity/ast/Types.h>
|
||||
#include <liblangutil/Exceptions.h>
|
||||
#include <test/libsolidity/util/SoltestTypes.h>
|
||||
|
||||
@ -64,7 +63,6 @@ public:
|
||||
std::vector<FunctionCall> parseFunctionCalls(std::size_t _lineOffset);
|
||||
|
||||
private:
|
||||
using Token = soltest::Token;
|
||||
/**
|
||||
* Token scanner that is used internally to abstract away character traversal.
|
||||
*/
|
||||
@ -92,7 +90,7 @@ private:
|
||||
char scanHexPart();
|
||||
|
||||
private:
|
||||
using TokenDesc = std::pair<Token, std::string>;
|
||||
using TokenDesc = std::pair<soltest::Token, std::string>;
|
||||
|
||||
/// Advances current position in the input stream.
|
||||
void advance(unsigned n = 1)
|
||||
|
@ -30,6 +30,8 @@ using namespace solidity::util;
|
||||
using namespace solidity::frontend::test;
|
||||
using namespace std;
|
||||
|
||||
using Token = soltest::Token;
|
||||
|
||||
string TestFunctionCall::format(
|
||||
ErrorReporter& _errorReporter,
|
||||
string const& _linePrefix,
|
||||
@ -37,9 +39,6 @@ string TestFunctionCall::format(
|
||||
bool const _highlight
|
||||
) const
|
||||
{
|
||||
using namespace soltest;
|
||||
using Token = soltest::Token;
|
||||
|
||||
stringstream stream;
|
||||
|
||||
bool highlight = !matchesExpectation() && _highlight;
|
||||
@ -279,8 +278,6 @@ string TestFunctionCall::formatFailure(
|
||||
bool _highlight
|
||||
) const
|
||||
{
|
||||
using Token = soltest::Token;
|
||||
|
||||
stringstream os;
|
||||
|
||||
os << formatToken(Token::Failure);
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <test/libsolidity/util/TestFileParser.h>
|
||||
#include <test/libsolidity/util/SoltestErrors.h>
|
||||
|
||||
#include <libsolidity/ast/Types.h>
|
||||
#include <liblangutil/Exceptions.h>
|
||||
#include <libsolutil/AnsiColorized.h>
|
||||
#include <libsolutil/CommonData.h>
|
||||
|
Loading…
Reference in New Issue
Block a user