aboutsummaryrefslogtreecommitdiffstats
path: root/liblangutil
diff options
context:
space:
mode:
authorChristian Parpart <christian@ethereum.org>2019-01-07 18:33:14 +0800
committerChristian Parpart <christian@ethereum.org>2019-01-07 18:33:14 +0800
commitc7074a365e3ff503b20c2a2f8638f5d3b7a8616b (patch)
treec32d1c64a3a18e039911f47fe5666e516c22c338 /liblangutil
parentd597b1dbb2490b7f977617173a101e705c8439d7 (diff)
downloaddexon-solidity-c7074a365e3ff503b20c2a2f8638f5d3b7a8616b.tar.gz
dexon-solidity-c7074a365e3ff503b20c2a2f8638f5d3b7a8616b.tar.zst
dexon-solidity-c7074a365e3ff503b20c2a2f8638f5d3b7a8616b.zip
Fixes SourceLocation extraction on multiline locations with a too long first line.
Diffstat (limited to 'liblangutil')
-rw-r--r--liblangutil/SourceReferenceExtractor.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/liblangutil/SourceReferenceExtractor.cpp b/liblangutil/SourceReferenceExtractor.cpp
index 4502bb23..1a6dbdb3 100644
--- a/liblangutil/SourceReferenceExtractor.cpp
+++ b/liblangutil/SourceReferenceExtractor.cpp
@@ -58,7 +58,9 @@ SourceReference SourceReferenceExtractor::extract(SourceLocation const* _locatio
int locationLength = isMultiline ? line.length() - start.column : end.column - start.column;
if (locationLength > 150)
{
- line = line.substr(0, start.column + 35) + " ... " + line.substr(end.column - 35);
+ int const lhs = start.column + 35;
+ int const rhs = (isMultiline ? line.length() : end.column) - 35;
+ line = line.substr(0, lhs) + " ... " + line.substr(rhs);
end.column = start.column + 75;
locationLength = 75;
}