mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
adde the positions for the end of SourceLocation
This commit is contained in:
parent
83c504ec89
commit
4fdfbaa367
@ -257,13 +257,16 @@ bytes CompilerStack::staticCompile(std::string const& _sourceCode, bool _optimiz
|
|||||||
return stack.compile(_sourceCode, _optimize);
|
return stack.compile(_sourceCode, _optimize);
|
||||||
}
|
}
|
||||||
|
|
||||||
pair<int, int> CompilerStack::positionFromSourceLocation(SourceLocation const& _sourceLocation) const
|
tuple<int, int, int, int> CompilerStack::positionFromSourceLocation(SourceLocation const& _sourceLocation) const
|
||||||
{
|
{
|
||||||
int initLine;
|
int startLine;
|
||||||
int initColumn;
|
int startColumn;
|
||||||
tie(initLine, initColumn) = getScanner(*_sourceLocation.sourceName).translatePositionToLineColumn(_sourceLocation.start);
|
int endLine;
|
||||||
|
int endColumn;
|
||||||
|
tie(startLine, startColumn) = getScanner(*_sourceLocation.sourceName).translatePositionToLineColumn(_sourceLocation.start);
|
||||||
|
tie(endLine, endColumn) = getScanner(*_sourceLocation.sourceName).translatePositionToLineColumn(_sourceLocation.end);
|
||||||
|
|
||||||
return make_pair(++initLine, ++initColumn);
|
return make_tuple(++startLine, ++startColumn, ++endLine, ++endColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompilerStack::reset(bool _keepSources)
|
void CompilerStack::reset(bool _keepSources)
|
||||||
|
@ -132,8 +132,10 @@ public:
|
|||||||
/// scanning the source code - this is useful for printing exception information.
|
/// scanning the source code - this is useful for printing exception information.
|
||||||
static bytes staticCompile(std::string const& _sourceCode, bool _optimize = false);
|
static bytes staticCompile(std::string const& _sourceCode, bool _optimize = false);
|
||||||
|
|
||||||
/// helper function for printing logs. Do only use in error cases, it's quite expensive.
|
/// Helper function for logs printing. Do only use in error cases, it's quite expensive.
|
||||||
std::pair<int, int> positionFromSourceLocation(SourceLocation const& _sourceLocation) const;
|
/// line and columns are numbered starting from 1 with following order:
|
||||||
|
/// start line, start column, end line, end column
|
||||||
|
std::tuple<int, int, int, int> positionFromSourceLocation(SourceLocation const& _sourceLocation) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user