mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #3092 from rivenhk/b_2885
added formatting when source snippets is too long
This commit is contained in:
commit
dc6b1f02bc
@ -19,6 +19,7 @@ Features:
|
||||
* Type Checker: Do not add members of ``address`` to contracts as experimental 0.5.0 feature.
|
||||
* Type Checker: Force interface functions to be external as experimental 0.5.0 feature.
|
||||
* Type Checker: Require ``storage`` or ``memory`` keyword for local variables as experimental 0.5.0 feature.
|
||||
* Compiler Interface: Better formatted error message for long source snippets
|
||||
|
||||
Bugfixes:
|
||||
* Code Generator: Allocate one byte per memory byte array element instead of 32.
|
||||
|
@ -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 + 35) + " ... " + line.substr(endColumn - 35);
|
||||
endColumn = startColumn + 75;
|
||||
locationLength = 75;
|
||||
}
|
||||
if (line.length() > 150)
|
||||
{
|
||||
line = " ... " + line.substr(startColumn, locationLength) + " ... ";
|
||||
startColumn = 5;
|
||||
endColumn = startColumn + locationLength;
|
||||
}
|
||||
|
||||
_stream << line << endl;
|
||||
for_each(
|
||||
line.cbegin(),
|
||||
|
Loading…
Reference in New Issue
Block a user