mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
remove non-functional column information from Location objects
This commit is contained in:
parent
5c63133226
commit
a9b37467a4
11 changed files with 15 additions and 32 deletions
14
src/Obj.h
14
src/Obj.h
|
@ -13,8 +13,7 @@ namespace detail {
|
|||
|
||||
class Location final {
|
||||
public:
|
||||
constexpr Location(const char* fname, int line_f, int line_l, int col_f, int col_l) noexcept
|
||||
: filename(fname), first_column(col_f), last_column(col_l) {
|
||||
constexpr Location(const char* fname, int line_f, int line_l) noexcept : filename(fname) {
|
||||
SetLines(line_f, line_l);
|
||||
}
|
||||
|
||||
|
@ -29,10 +28,6 @@ public:
|
|||
int FirstLine() const { return first_line; }
|
||||
int LastLine() const { return last_line; }
|
||||
|
||||
// Columns are actually not currently maintained.
|
||||
auto FirstColumn() const { return first_column; }
|
||||
auto LastColumn() const { return last_column; }
|
||||
|
||||
void SetFile(const char* fname) { filename = fname; }
|
||||
void SetLine(int line) { SetLines(line, line); }
|
||||
constexpr void SetLines(int first, int last) {
|
||||
|
@ -53,14 +48,9 @@ public:
|
|||
last_line += incr;
|
||||
}
|
||||
|
||||
void SetFirstColumn(int col) { first_column = col; }
|
||||
void SetLastColumn(int col) { last_column = col; }
|
||||
|
||||
|
||||
private:
|
||||
const char* filename = nullptr;
|
||||
int first_line = 0, last_line = 0;
|
||||
int first_column = 0, last_column = 0; // not currently maintained
|
||||
};
|
||||
|
||||
#define YYLTYPE zeek::detail::yyltype
|
||||
|
@ -69,7 +59,7 @@ YYLTYPE GetCurrentLocation();
|
|||
void SetCurrentLocation(YYLTYPE currloc);
|
||||
|
||||
// Used to mean "no location associated with this object".
|
||||
inline constexpr Location no_location("<no location>", 0, 0, 0, 0);
|
||||
inline constexpr Location no_location("<no location>", 0, 0);
|
||||
|
||||
// Current start/end location.
|
||||
extern Location start_location;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue