зеркало из https://github.com/github/ruby.git
[ruby/prism] Include field comments in Java source
https://github.com/ruby/prism/commit/4a9389f304
This commit is contained in:
Родитель
c7ce2f537f
Коммит
7304d56236
|
@ -166,7 +166,13 @@ typedef struct pm_<%= node.human %> {
|
|||
<%- node.fields.grep_v(Prism::FlagsField).each do |field| -%>
|
||||
|
||||
/**
|
||||
* <%= node.name %>#<%= field.name %><%= "\n *\n * " + field.comment.split("\n").join("\n * ") if field.comment %>
|
||||
* <%= node.name %>#<%= field.name %>
|
||||
<%- if field.comment -%>
|
||||
*
|
||||
<%- field.each_comment_line do |line| -%>
|
||||
*<%= line %>
|
||||
<%- end -%>
|
||||
<%- end -%>
|
||||
*/
|
||||
<%= case field
|
||||
when Prism::NodeField, Prism::OptionalNodeField then "struct #{field.c_type} *#{field.name}"
|
||||
|
|
|
@ -47,7 +47,9 @@ module Prism
|
|||
<%- if field.comment.nil? -%>
|
||||
# <%= "private " if field.is_a?(Prism::FlagsField) %>attr_reader <%= field.name %>: <%= field.rbs_class %>
|
||||
<%- else -%>
|
||||
# <%= field.comment.split("\n").join("\n # ") %>
|
||||
<%- field.each_comment_line do |line| -%>
|
||||
#<%= line %>
|
||||
<%- end -%>
|
||||
<%- end -%>
|
||||
<%= "private " if field.is_a?(Prism::FlagsField) %>attr_reader :<%= field.name %>
|
||||
|
||||
|
|
|
@ -21,6 +21,10 @@ module Prism
|
|||
@options = options
|
||||
end
|
||||
|
||||
def each_comment_line
|
||||
comment.each_line { |line| yield line.prepend(" ").rstrip } if comment
|
||||
end
|
||||
|
||||
def semantic_field?
|
||||
true
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче