aboutsummaryrefslogtreecommitdiffstats
path: root/liblangutil/SourceReferenceExtractor.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-12-19 22:11:20 +0800
committerGitHub <noreply@github.com>2018-12-19 22:11:20 +0800
commitc8f20e075f46ce35a9975f43676dbe1794d7ea29 (patch)
tree642c9567b2272cd4450a702f2a735d1243754543 /liblangutil/SourceReferenceExtractor.h
parent8875092073a30c94659f8a373658ca8286803054 (diff)
parent62fe57479e7d8949e4ed2e0efb31238d5d8d6d0a (diff)
downloaddexon-solidity-c8f20e075f46ce35a9975f43676dbe1794d7ea29.tar
dexon-solidity-c8f20e075f46ce35a9975f43676dbe1794d7ea29.tar.gz
dexon-solidity-c8f20e075f46ce35a9975f43676dbe1794d7ea29.tar.bz2
dexon-solidity-c8f20e075f46ce35a9975f43676dbe1794d7ea29.tar.lz
dexon-solidity-c8f20e075f46ce35a9975f43676dbe1794d7ea29.tar.xz
dexon-solidity-c8f20e075f46ce35a9975f43676dbe1794d7ea29.tar.zst
dexon-solidity-c8f20e075f46ce35a9975f43676dbe1794d7ea29.zip
Merge pull request #5635 from ethereum/cpp-default-ctors
[RFC] C++ `=default` ctors/dtors and the use of non-static member initializer syntax.
Diffstat (limited to 'liblangutil/SourceReferenceExtractor.h')
-rw-r--r--liblangutil/SourceReferenceExtractor.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/liblangutil/SourceReferenceExtractor.h b/liblangutil/SourceReferenceExtractor.h
index 0be7e9d8..bcbc50bc 100644
--- a/liblangutil/SourceReferenceExtractor.h
+++ b/liblangutil/SourceReferenceExtractor.h
@@ -31,28 +31,29 @@ namespace langutil
struct LineColumn
{
- int line;
- int column;
+ int line = {-1};
+ int column = {-1};
+ LineColumn() = default;
LineColumn(std::tuple<int, int> const& _t): line{std::get<0>(_t)}, column{std::get<1>(_t)} {}
- LineColumn(int _line, int _column): line{_line}, column{_column} {}
- LineColumn(): line{-1}, column{-1} {}
};
struct SourceReference
{
- std::string message; ///< A message that relates to this source reference (such as a warning or an error message).
- std::string sourceName; ///< Underlying source name (for example the filename).
- LineColumn position; ///< Actual (error) position this source reference is surrounding.
- bool multiline; ///< Indicates whether the actual SourceReference is truncated to one line.
- std::string text; ///< Extracted source code text (potentially truncated if multiline or too long).
- int startColumn; ///< Highlighting range-start of text field.
- int endColumn; ///< Highlighting range-end of text field.
+ std::string message; ///< A message that relates to this source reference (such as a warning or an error message).
+ std::string sourceName; ///< Underlying source name (for example the filename).
+ LineColumn position; ///< Actual (error) position this source reference is surrounding.
+ bool multiline = {false}; ///< Indicates whether the actual SourceReference is truncated to one line.
+ std::string text; ///< Extracted source code text (potentially truncated if multiline or too long).
+ int startColumn = {-1}; ///< Highlighting range-start of text field.
+ int endColumn = {-1}; ///< Highlighting range-end of text field.
/// Constructs a SourceReference containing a message only.
static SourceReference MessageOnly(std::string _msg)
{
- return SourceReference{std::move(_msg), "", LineColumn{-1, -1}, false, "", -1, -1};
+ SourceReference sref;
+ sref.message = std::move(_msg);
+ return sref;
}
};