Skip to content

Commit

Permalink
nixd/Syntax: const-correctness for getKind
Browse files Browse the repository at this point in the history
  • Loading branch information
inclyc committed Sep 21, 2023
1 parent 9b81d94 commit 55355c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nixd/include/nixd/Syntax/Nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ struct Node {
#include "Nodes.inc"
#undef NODE
};
virtual NodeKind getKind() { return NK_Node; };
[[nodiscard]] virtual NodeKind getKind() const { return NK_Node; };
virtual ~Node() = default;
};

#define COMMON_METHOD virtual NodeKind getKind() override;
#define COMMON_METHOD virtual NodeKind getKind() const override;

#define NODE(NAME, BODY) struct NAME : Node BODY;
#include "Nodes.inc"
#undef NODE
#undef COMMON_METHOD

#define NODE(NAME, _) \
inline Node::NodeKind NAME::getKind() { return NK_##NAME; }
inline Node::NodeKind NAME::getKind() const { return NK_##NAME; }
#include "Nodes.inc"
#undef NODE

Expand Down

0 comments on commit 55355c6

Please sign in to comment.