diff options
author | chriseth <chris@ethereum.org> | 2018-12-01 06:45:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-01 06:45:31 +0800 |
commit | aaeb74f59283486ee95d71f896cf2dd6cbe503f7 (patch) | |
tree | 062fbcc8d84ce2bfa5bb0bb2ef200ba402bb3e8b /libsolidity/interface/CompilerStack.cpp | |
parent | cc00d8172b6cd7f9fc032e4a21857455ace2f290 (diff) | |
parent | 757623e381aba24b81a2365cf19037d3d96bf945 (diff) | |
download | dexon-solidity-aaeb74f59283486ee95d71f896cf2dd6cbe503f7.tar dexon-solidity-aaeb74f59283486ee95d71f896cf2dd6cbe503f7.tar.gz dexon-solidity-aaeb74f59283486ee95d71f896cf2dd6cbe503f7.tar.bz2 dexon-solidity-aaeb74f59283486ee95d71f896cf2dd6cbe503f7.tar.lz dexon-solidity-aaeb74f59283486ee95d71f896cf2dd6cbe503f7.tar.xz dexon-solidity-aaeb74f59283486ee95d71f896cf2dd6cbe503f7.tar.zst dexon-solidity-aaeb74f59283486ee95d71f896cf2dd6cbe503f7.zip |
Merge pull request #5537 from ethereum/cp-SourceLocation-related-refactoring
[1/3] SourceLocation related refactoring.
Diffstat (limited to 'libsolidity/interface/CompilerStack.cpp')
-rw-r--r-- | libsolidity/interface/CompilerStack.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 623ccca8..610caea1 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -126,7 +126,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)); m_sources[_name].isLibrary = _isLibrary; m_stackState = SourcesSet; return existed; @@ -161,7 +161,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)); sourcesToParse.push_back(newPath); } } @@ -612,8 +612,8 @@ tuple<int, int, int, int> CompilerStack::positionFromSourceLocation(SourceLocati int startColumn; int endLine; int endColumn; - tie(startLine, startColumn) = scanner(*_sourceLocation.sourceName).translatePositionToLineColumn(_sourceLocation.start); - tie(endLine, endColumn) = scanner(*_sourceLocation.sourceName).translatePositionToLineColumn(_sourceLocation.end); + tie(startLine, startColumn) = scanner(_sourceLocation.source->name()).translatePositionToLineColumn(_sourceLocation.start); + tie(endLine, endColumn) = scanner(_sourceLocation.source->name()).translatePositionToLineColumn(_sourceLocation.end); return make_tuple(++startLine, ++startColumn, ++endLine, ++endColumn); } @@ -936,8 +936,8 @@ string CompilerStack::computeSourceMapping(eth::AssemblyItems const& _items) con SourceLocation const& location = item.location(); int length = location.start != -1 && location.end != -1 ? location.end - location.start : -1; int sourceIndex = - location.sourceName && sourceIndicesMap.count(*location.sourceName) ? - sourceIndicesMap.at(*location.sourceName) : + location.source && sourceIndicesMap.count(location.source->name()) ? + sourceIndicesMap.at(location.source->name()) : -1; char jump = '-'; if (item.getJumpType() == eth::AssemblyItem::JumpType::IntoFunction) |