aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CompilerStack.cpp15
-rw-r--r--CompilerStack.h6
2 files changed, 13 insertions, 8 deletions
diff --git a/CompilerStack.cpp b/CompilerStack.cpp
index a1c9b4a5..b3fedc45 100644
--- a/CompilerStack.cpp
+++ b/CompilerStack.cpp
@@ -257,13 +257,16 @@ bytes CompilerStack::staticCompile(std::string const& _sourceCode, bool _optimiz
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 initColumn;
- tie(initLine, initColumn) = getScanner(*_sourceLocation.sourceName).translatePositionToLineColumn(_sourceLocation.start);
-
- return make_pair(++initLine, ++initColumn);
+ int startLine;
+ int startColumn;
+ int endLine;
+ int endColumn;
+ tie(startLine, startColumn) = getScanner(*_sourceLocation.sourceName).translatePositionToLineColumn(_sourceLocation.start);
+ tie(endLine, endColumn) = getScanner(*_sourceLocation.sourceName).translatePositionToLineColumn(_sourceLocation.end);
+
+ return make_tuple(++startLine, ++startColumn, ++endLine, ++endColumn);
}
void CompilerStack::reset(bool _keepSources)
diff --git a/CompilerStack.h b/CompilerStack.h
index 3eff7577..2ad791f2 100644
--- a/CompilerStack.h
+++ b/CompilerStack.h
@@ -132,8 +132,10 @@ public:
/// scanning the source code - this is useful for printing exception information.
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.
- std::pair<int, int> positionFromSourceLocation(SourceLocation const& _sourceLocation) const;
+ /// Helper function for logs printing. Do only use in error cases, it's quite expensive.
+ /// 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:
/**