summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2023-10-18 18:27:19 +0200
committergit <svn-admin@ruby-lang.org>2023-10-23 12:50:14 +0000
commitf82d0ab5d117cf2e7cac8fd84a25ba7077da8947 (patch)
tree3a73489d7a4711e42ae455e5f459d593c06ff2e4
parent42c2c8caa51bb8dee9d658aa194ccaa924d760d2 (diff)
[ruby/prism] Exclude comments when only serializing semantic fields
https://github.com/ruby/prism/commit/6f4fab362e
-rw-r--r--prism/templates/src/serialize.c.erb2
1 files changed, 2 insertions, 0 deletions
diff --git a/prism/templates/src/serialize.c.erb b/prism/templates/src/serialize.c.erb
index 006fae6fc0..e985e72ec3 100644
--- a/prism/templates/src/serialize.c.erb
+++ b/prism/templates/src/serialize.c.erb
@@ -200,7 +200,9 @@ pm_serialize_encoding(pm_encoding_t *encoding, pm_buffer_t *buffer) {
void
pm_serialize_content(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
pm_serialize_encoding(&parser->encoding, buffer);
+<%- unless Prism::SERIALIZE_ONLY_SEMANTICS_FIELDS -%>
pm_serialize_comment_list(parser, &parser->comment_list, buffer);
+<%- end -%>
pm_serialize_magic_comment_list(parser, &parser->magic_comment_list, buffer);
pm_serialize_diagnostic_list(parser, &parser->error_list, buffer);
pm_serialize_diagnostic_list(parser, &parser->warning_list, buffer);