Skip to content

Commit 11aea8c

Browse files
committed
node attribute should decorate with const
1 parent 287e149 commit 11aea8c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Extension.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace YAML {
2121
using namespace io::substrait;
2222

2323
static bool decodeFunctionVariant(const Node &node, FunctionVariant &function) {
24-
auto &returnType = node["return"];
24+
const auto &returnType = node["return"];
2525
if (returnType && returnType.IsScalar()) {
2626
/// Return type can be an expression.
2727
const auto &returnExpr = returnType.as<std::string>();
@@ -34,7 +34,7 @@ static bool decodeFunctionVariant(const Node &node, FunctionVariant &function) {
3434
}
3535
function.returnType = Type::decode(lastReturnType);
3636
}
37-
auto &args = node["args"];
37+
const auto &args = node["args"];
3838
if (args && args.IsSequence()) {
3939
for (auto &arg : args) {
4040
if (arg["options"]) { // enum argument
@@ -53,7 +53,7 @@ static bool decodeFunctionVariant(const Node &node, FunctionVariant &function) {
5353
}
5454
}
5555

56-
auto &variadic = node["variadic"];
56+
const auto &variadic = node["variadic"];
5757
if (variadic) {
5858
auto &min = variadic["min"];
5959
auto &max = variadic["max"];
@@ -74,7 +74,7 @@ static bool decodeFunctionVariant(const Node &node, FunctionVariant &function) {
7474
template <> struct convert<EnumArgument> {
7575
static bool decode(const Node &node, EnumArgument &argument) {
7676
// 'options' is required property
77-
auto &options = node["options"];
77+
const auto &options = node["options"];
7878
if (options && options.IsSequence()) {
7979
auto &required = node["required"];
8080
argument.required = required && required.as<bool>();
@@ -87,7 +87,7 @@ template <> struct convert<EnumArgument> {
8787

8888
template <> struct convert<ValueArgument> {
8989
static bool decode(const Node &node, ValueArgument &argument) {
90-
auto &value = node["value"];
90+
const auto &value = node["value"];
9191
if (value && value.IsScalar()) {
9292
auto valueType = value.as<std::string>();
9393
argument.type = Type::decode(valueType);
@@ -126,7 +126,7 @@ template <> struct convert<AggregateFunctionVariant> {
126126

127127
template <> struct convert<io::substrait::TypeVariant> {
128128
static bool decode(const Node &node, io::substrait::TypeVariant &typeAnchor) {
129-
auto &name = node["name"];
129+
const auto &name = node["name"];
130130
if (name && name.IsScalar()) {
131131
typeAnchor.name = name.as<std::string>();
132132
return true;
@@ -207,7 +207,7 @@ Extension::load(const std::vector<std::string> &extensionFiles) {
207207
}
208208
}
209209

210-
auto &aggregateFunctions = node["aggregate_functions"];
210+
const auto &aggregateFunctions = node["aggregate_functions"];
211211
if (aggregateFunctions && aggregateFunctions.IsSequence()) {
212212
for (auto &aggregateFunctionNode : aggregateFunctions) {
213213
const auto functionName =
@@ -225,7 +225,7 @@ Extension::load(const std::vector<std::string> &extensionFiles) {
225225
}
226226
}
227227

228-
auto &types = node["types"];
228+
const auto &types = node["types"];
229229
if (types && types.IsSequence()) {
230230
for (auto &type : types) {
231231
auto typeAnchor = type.as<TypeVariant>();

0 commit comments

Comments
 (0)