Copilot commented on code in PR #3889:
URL: https://github.com/apache/avro/pull/3889#discussion_r3612735664


##########
lang/c++/impl/Compiler.cc:
##########
@@ -427,6 +446,7 @@ static NodePtr makeEnumNode(const Entity &e,
         if (it.type() != json::EntityType::String) {
             throw Exception("Enum symbol not a string: {}", it.toString());
         }
+        validateSimpleName(it.stringValue(), "enum symbol");
         symbols.add(it.stringValue());

Review Comment:
   `it.stringValue()` is called twice (once for validation and once when adding 
the symbol). `Entity::stringValue()` performs a type check and conversion, so 
calling it twice does redundant work and repeats any unescaping/conversion 
logic.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to