diff options
author | Kevin Newton <kddnewton@gmail.com> | 2023-11-03 09:40:19 -0400 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-11-03 14:35:08 +0000 |
commit | 4b5f516f2efbe73133c41f799b3afb9f776b4680 (patch) | |
tree | 0aea0e0f60070f9af9a3c337f267aedfd4079f22 /prism/templates/lib | |
parent | 1321df773b6316d2e88dfcada7844e00762d5a94 (diff) | |
download | ruby-4b5f516f2efbe73133c41f799b3afb9f776b4680.tar.gz |
[ruby/prism] Split comment
We were previously holding a type field on Comment to tell what
kind of comment it was. Instead, let's just use actual classes for
this.
https://github.com/ruby/prism/commit/e76830ca6e
Diffstat (limited to 'prism/templates/lib')
-rw-r--r-- | prism/templates/lib/prism/serialize.rb.erb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/prism/templates/lib/prism/serialize.rb.erb b/prism/templates/lib/prism/serialize.rb.erb index ef8ebbbae8..32bc741178 100644 --- a/prism/templates/lib/prism/serialize.rb.erb +++ b/prism/templates/lib/prism/serialize.rb.erb @@ -86,7 +86,13 @@ module Prism end def load_comments - load_varint.times.map { Comment.new(Comment::TYPES.fetch(load_varint), load_location) } + load_varint.times.map do + case load_varint + when 0 then InlineComment.new(load_location) + when 1 then EmbDocComment.new(load_location) + when 2 then DATAComment.new(load_location) + end + end end def load_metadata |