mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Eliminate unnecessary m_source from Parser
This commit is contained in:
parent
6294aa871a
commit
d203c80abd
@ -119,6 +119,8 @@ public:
|
|||||||
rescan();
|
rescan();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CharStream const& charStream() const noexcept { return m_source; }
|
||||||
|
|
||||||
/// @returns the next token and advances input
|
/// @returns the next token and advances input
|
||||||
Token next();
|
Token next();
|
||||||
|
|
||||||
|
@ -87,7 +87,6 @@ ASTPointer<SourceUnit> Parser::parse(CharStream& _charStream)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_recursionDepth = 0;
|
m_recursionDepth = 0;
|
||||||
m_source = &_charStream;
|
|
||||||
m_scanner = make_shared<Scanner>(_charStream);
|
m_scanner = make_shared<Scanner>(_charStream);
|
||||||
ASTNodeFactory nodeFactory(*this);
|
ASTNodeFactory nodeFactory(*this);
|
||||||
|
|
||||||
@ -2057,8 +2056,6 @@ bool Parser::variableDeclarationStart()
|
|||||||
|
|
||||||
optional<string> Parser::findLicenseString(std::vector<ASTPointer<ASTNode>> const& _nodes)
|
optional<string> Parser::findLicenseString(std::vector<ASTPointer<ASTNode>> const& _nodes)
|
||||||
{
|
{
|
||||||
solAssert(!!m_source, "");
|
|
||||||
|
|
||||||
// We circumvent the scanner here, because it skips non-docstring comments.
|
// We circumvent the scanner here, because it skips non-docstring comments.
|
||||||
static regex const licenseRegex("SPDX-License-Identifier:\\s*([a-zA-Z0-9 ()+.-]+)");
|
static regex const licenseRegex("SPDX-License-Identifier:\\s*([a-zA-Z0-9 ()+.-]+)");
|
||||||
|
|
||||||
@ -2066,7 +2063,7 @@ optional<string> Parser::findLicenseString(std::vector<ASTPointer<ASTNode>> cons
|
|||||||
// This will leave e.g. "global comments".
|
// This will leave e.g. "global comments".
|
||||||
using iter = std::string::const_iterator;
|
using iter = std::string::const_iterator;
|
||||||
vector<pair<iter, iter>> sequencesToSearch;
|
vector<pair<iter, iter>> sequencesToSearch;
|
||||||
string const& source = m_source->source();
|
string const& source = m_scanner->charStream().source();
|
||||||
sequencesToSearch.emplace_back(source.begin(), source.end());
|
sequencesToSearch.emplace_back(source.begin(), source.end());
|
||||||
for (ASTPointer<ASTNode> const& node: _nodes)
|
for (ASTPointer<ASTNode> const& node: _nodes)
|
||||||
if (node->location().hasText())
|
if (node->location().hasText())
|
||||||
|
@ -211,7 +211,6 @@ private:
|
|||||||
/// Creates an empty ParameterList at the current location (used if parameters can be omitted).
|
/// Creates an empty ParameterList at the current location (used if parameters can be omitted).
|
||||||
ASTPointer<ParameterList> createEmptyParameterList();
|
ASTPointer<ParameterList> createEmptyParameterList();
|
||||||
|
|
||||||
langutil::CharStream* m_source = nullptr;
|
|
||||||
/// Flag that signifies whether '_' is parsed as a PlaceholderStatement or a regular identifier.
|
/// Flag that signifies whether '_' is parsed as a PlaceholderStatement or a regular identifier.
|
||||||
bool m_insideModifier = false;
|
bool m_insideModifier = false;
|
||||||
langutil::EVMVersion m_evmVersion;
|
langutil::EVMVersion m_evmVersion;
|
||||||
|
Loading…
Reference in New Issue
Block a user