From 5c3dfdc05ba11c604486f0147ab7d4ed4db17056 Mon Sep 17 00:00:00 2001 From: Yingchi Long Date: Thu, 21 Sep 2023 01:02:28 +0800 Subject: [PATCH] nixd/Syntax: const-correctness for `getKind` --- nixd/include/nixd/Syntax/Nodes.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nixd/include/nixd/Syntax/Nodes.h b/nixd/include/nixd/Syntax/Nodes.h index 9019acc14..0d2ab67ef 100644 --- a/nixd/include/nixd/Syntax/Nodes.h +++ b/nixd/include/nixd/Syntax/Nodes.h @@ -15,11 +15,11 @@ 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" @@ -27,7 +27,7 @@ struct 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