aboutsummaryrefslogtreecommitdiffstats
path: root/liblangutil
diff options
context:
space:
mode:
authorChristian Parpart <christian@ethereum.org>2018-11-29 08:58:15 +0800
committerChristian Parpart <christian@ethereum.org>2018-12-01 00:07:17 +0800
commit435f7b3b72157e884344adbc7b62033bd08bb51c (patch)
treede4831bb56b16945894b9efc0bea95576b43cea9 /liblangutil
parentc48a5264be4221873fe02cac57f6a41a32010fea (diff)
downloaddexon-solidity-435f7b3b72157e884344adbc7b62033bd08bb51c.tar.gz
dexon-solidity-435f7b3b72157e884344adbc7b62033bd08bb51c.tar.zst
dexon-solidity-435f7b3b72157e884344adbc7b62033bd08bb51c.zip
liblangutil: Scanner: remove superfluous sourceName field (it's in CharStream already)
Also, ParserBase::sourceName() was dead code. Eliminating it should increase test coverage (how sneaky) :-)
Diffstat (limited to 'liblangutil')
-rw-r--r--liblangutil/ParserBase.cpp5
-rw-r--r--liblangutil/ParserBase.h1
-rw-r--r--liblangutil/Scanner.cpp3
-rw-r--r--liblangutil/Scanner.h9
4 files changed, 4 insertions, 14 deletions
diff --git a/liblangutil/ParserBase.cpp b/liblangutil/ParserBase.cpp
index c103475a..391af291 100644
--- a/liblangutil/ParserBase.cpp
+++ b/liblangutil/ParserBase.cpp
@@ -27,11 +27,6 @@
using namespace std;
using namespace langutil;
-std::shared_ptr<string const> const& ParserBase::sourceName() const
-{
- return m_scanner->sourceName();
-}
-
int ParserBase::position() const
{
return m_scanner->currentLocation().start;
diff --git a/liblangutil/ParserBase.h b/liblangutil/ParserBase.h
index f6315351..855201e2 100644
--- a/liblangutil/ParserBase.h
+++ b/liblangutil/ParserBase.h
@@ -38,7 +38,6 @@ class ParserBase
public:
explicit ParserBase(ErrorReporter& errorReporter): m_errorReporter(errorReporter) {}
- std::shared_ptr<std::string const> const& sourceName() const;
std::shared_ptr<CharStream> source() const { return m_scanner->charStream(); }
protected:
diff --git a/liblangutil/Scanner.cpp b/liblangutil/Scanner.cpp
index 5c0f356e..ac298bd5 100644
--- a/liblangutil/Scanner.cpp
+++ b/liblangutil/Scanner.cpp
@@ -167,10 +167,9 @@ private:
}; // end of LiteralScope class
-void Scanner::reset(CharStream _source, string _sourceName)
+void Scanner::reset(CharStream _source)
{
m_source = make_shared<CharStream>(std::move(_source));
- m_sourceName = make_shared<string const>(std::move(_sourceName));
reset();
}
diff --git a/liblangutil/Scanner.h b/liblangutil/Scanner.h
index dc37745f..a1185369 100644
--- a/liblangutil/Scanner.h
+++ b/liblangutil/Scanner.h
@@ -91,14 +91,14 @@ class Scanner
friend class LiteralScope;
public:
explicit Scanner(std::shared_ptr<CharStream> _source) { reset(std::move(_source)); }
- explicit Scanner(CharStream _source = CharStream(), std::string _sourceName = "") { reset(std::move(_source), std::move(_sourceName)); }
+ explicit Scanner(CharStream _source = CharStream()) { reset(std::move(_source)); }
std::string source() const { return m_source->source(); }
std::shared_ptr<CharStream> charStream() noexcept { return m_source; }
- /// Resets the scanner as if newly constructed with _source and _sourceName as input.
- void reset(CharStream _source, std::string _sourceName);
+ /// Resets the scanner as if newly constructed with _source as input.
+ void reset(CharStream _source);
void reset(std::shared_ptr<CharStream> _source);
/// Resets scanner to the start of input.
void reset();
@@ -150,8 +150,6 @@ public:
std::string const& peekLiteral() const { return m_nextToken.literal; }
///@}
- std::shared_ptr<std::string const> const& sourceName() const { return m_sourceName; }
-
///@{
///@name Error printing helper functions
/// Functions that help pretty-printing parse errors
@@ -242,7 +240,6 @@ private:
TokenDesc m_nextToken; // desc for next token (one token look-ahead)
std::shared_ptr<CharStream> m_source;
- std::shared_ptr<std::string const> m_sourceName;
/// one character look-ahead, equals 0 at end of input
char m_char;