mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
added formatting when source snippets is too long
This commit is contained in:
parent
846b43479d
commit
b93a5980ed
@ -49,6 +49,21 @@ void SourceReferenceFormatter::printSourceLocation(
|
||||
if (startLine == endLine)
|
||||
{
|
||||
string line = scanner.lineAtPosition(_location->start);
|
||||
|
||||
int locationLength = endColumn - startColumn;
|
||||
if (locationLength > 150)
|
||||
{
|
||||
line = line.substr(0, startColumn) + line.substr(startColumn, 15) + "..." + line.substr(endColumn - 15, 15) + line.substr(endColumn, line.length() - endColumn);
|
||||
endColumn = startColumn + 33;
|
||||
locationLength = 33;
|
||||
}
|
||||
if (line.length() > 150)
|
||||
{
|
||||
line = "..." + line.substr(startColumn, locationLength) + "...";
|
||||
startColumn = 3;
|
||||
endColumn = startColumn + locationLength;
|
||||
}
|
||||
|
||||
_stream << line << endl;
|
||||
for_each(
|
||||
line.cbegin(),
|
||||
|
Loading…
Reference in New Issue
Block a user