From 558a4ac49c40761697580e0915490714c4370767 Mon Sep 17 00:00:00 2001 From: liangdzou Date: Tue, 11 Sep 2018 03:22:13 +0800 Subject: give more information (at most 35 chars before and after) for too long lines add tests for giving more informations for too long lines add edge tests for giving more informations for too long lines avoid printing out tailing white space update test case after avoiding printing out trailing whitespace update test case for removing the pre-release warning from reference refactor the code to if-else flavor rename folder to cmdlineErrorReports under test rename folder to cmdlineErrorReports under test ignore whitespace for reference files avoiding to modify the file stderr_path by call sed without -i option print ' ...' instead of ' ... ' at the end of a line --- libsolidity/interface/SourceReferenceFormatter.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libsolidity/interface/SourceReferenceFormatter.cpp') diff --git a/libsolidity/interface/SourceReferenceFormatter.cpp b/libsolidity/interface/SourceReferenceFormatter.cpp index 0f014372..4724fc7f 100644 --- a/libsolidity/interface/SourceReferenceFormatter.cpp +++ b/libsolidity/interface/SourceReferenceFormatter.cpp @@ -55,8 +55,14 @@ void SourceReferenceFormatter::printSourceLocation(SourceLocation const* _locati } if (line.length() > 150) { - line = " ... " + line.substr(startColumn, locationLength) + " ... "; - startColumn = 5; + int len = line.length(); + line = line.substr(max(0, startColumn - 35), min(startColumn, 35) + min(locationLength + 35, len - startColumn)); + if (startColumn + locationLength + 35 < len) + line += " ..."; + if (startColumn > 35) { + line = " ... " + line; + startColumn = 40; + } endColumn = startColumn + locationLength; } -- cgit v1.2.3 From 24e5dcc352e9ce9569138dfa5af96fbf72ad3604 Mon Sep 17 00:00:00 2001 From: liangdzou Date: Wed, 19 Sep 2018 00:04:11 +0800 Subject: fix code format problems --- libsolidity/interface/SourceReferenceFormatter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libsolidity/interface/SourceReferenceFormatter.cpp') diff --git a/libsolidity/interface/SourceReferenceFormatter.cpp b/libsolidity/interface/SourceReferenceFormatter.cpp index 4724fc7f..865907e2 100644 --- a/libsolidity/interface/SourceReferenceFormatter.cpp +++ b/libsolidity/interface/SourceReferenceFormatter.cpp @@ -59,7 +59,8 @@ void SourceReferenceFormatter::printSourceLocation(SourceLocation const* _locati line = line.substr(max(0, startColumn - 35), min(startColumn, 35) + min(locationLength + 35, len - startColumn)); if (startColumn + locationLength + 35 < len) line += " ..."; - if (startColumn > 35) { + if (startColumn > 35) + { line = " ... " + line; startColumn = 40; } -- cgit v1.2.3