mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
liblangutil: extends CharStream to know about the respective (file-)name (and adapt codebase to it)
This commit is contained in:
@@ -360,7 +360,7 @@ void CompilerContext::appendInlineAssembly(
|
||||
|
||||
ErrorList errors;
|
||||
ErrorReporter errorReporter(errors);
|
||||
auto scanner = make_shared<langutil::Scanner>(langutil::CharStream(_assembly), "--CODEGEN--");
|
||||
auto scanner = make_shared<langutil::Scanner>(langutil::CharStream(_assembly, "--CODEGEN--"), "--CODEGEN--");
|
||||
auto parserResult = yul::Parser(errorReporter, yul::AsmFlavour::Strict).parse(scanner, false);
|
||||
#ifdef SOL_OUTPUT_ASM
|
||||
cout << yul::AsmPrinter()(*parserResult) << endl;
|
||||
|
||||
@@ -69,7 +69,7 @@ bool AssemblyStack::parseAndAnalyze(std::string const& _sourceName, std::string
|
||||
{
|
||||
m_errors.clear();
|
||||
m_analysisSuccessful = false;
|
||||
m_scanner = make_shared<Scanner>(CharStream(_source), _sourceName);
|
||||
m_scanner = make_shared<Scanner>(CharStream(_source, _sourceName), _sourceName);
|
||||
m_parserResult = yul::ObjectParser(m_errorReporter, languageToAsmFlavour(m_language)).parse(m_scanner, false);
|
||||
if (!m_errorReporter.errors().empty())
|
||||
return false;
|
||||
|
||||
@@ -125,7 +125,7 @@ bool CompilerStack::addSource(string const& _name, string const& _content, bool
|
||||
{
|
||||
bool existed = m_sources.count(_name) != 0;
|
||||
reset(true);
|
||||
m_sources[_name].scanner = make_shared<Scanner>(CharStream(_content), _name);
|
||||
m_sources[_name].scanner = make_shared<Scanner>(CharStream(_content, _name), _name);
|
||||
m_sources[_name].isLibrary = _isLibrary;
|
||||
m_stackState = SourcesSet;
|
||||
return existed;
|
||||
@@ -160,7 +160,7 @@ bool CompilerStack::parse()
|
||||
{
|
||||
string const& newPath = newSource.first;
|
||||
string const& newContents = newSource.second;
|
||||
m_sources[newPath].scanner = make_shared<Scanner>(CharStream(newContents), newPath);
|
||||
m_sources[newPath].scanner = make_shared<Scanner>(CharStream(newContents, newPath), newPath);
|
||||
sourcesToParse.push_back(newPath);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user