[ruby/rdoc] extract Comment creation in Parser::C
This is a prefactor for fixing comment format handling. https://github.com/ruby/rdoc/commit/a3d366feed
This commit is contained in:
parent
9225f3c1c6
commit
d4894e81c0
@ -439,7 +439,7 @@ class RDoc::Parser::C < RDoc::Parser
|
||||
next unless cls = @classes[c]
|
||||
m = @known_classes[m] || m
|
||||
|
||||
comment = RDoc::Comment.new '', @top_level, :c
|
||||
comment = new_comment '', @top_level, :c
|
||||
incl = cls.add_include RDoc::Include.new(m, comment)
|
||||
incl.record_location @top_level
|
||||
end
|
||||
@ -521,7 +521,7 @@ class RDoc::Parser::C < RDoc::Parser
|
||||
\s*"#{Regexp.escape new_name}"\s*,
|
||||
\s*"#{Regexp.escape old_name}"\s*\);%xm
|
||||
|
||||
RDoc::Comment.new($1 || '', @top_level, :c)
|
||||
new_comment($1 || '', @top_level, :c)
|
||||
end
|
||||
|
||||
##
|
||||
@ -560,7 +560,7 @@ class RDoc::Parser::C < RDoc::Parser
|
||||
''
|
||||
end
|
||||
|
||||
RDoc::Comment.new comment, @top_level, :c
|
||||
new_comment comment, @top_level, :c
|
||||
end
|
||||
|
||||
##
|
||||
@ -600,7 +600,7 @@ class RDoc::Parser::C < RDoc::Parser
|
||||
|
||||
case type
|
||||
when :func_def
|
||||
comment = RDoc::Comment.new args[0], @top_level, :c
|
||||
comment = new_comment args[0], @top_level, :c
|
||||
body = args[1]
|
||||
offset, = args[2]
|
||||
|
||||
@ -630,7 +630,7 @@ class RDoc::Parser::C < RDoc::Parser
|
||||
|
||||
body
|
||||
when :macro_def
|
||||
comment = RDoc::Comment.new args[0], @top_level, :c
|
||||
comment = new_comment args[0], @top_level, :c
|
||||
body = args[1]
|
||||
offset, = args[2]
|
||||
|
||||
@ -737,7 +737,7 @@ class RDoc::Parser::C < RDoc::Parser
|
||||
comment = ''
|
||||
end
|
||||
|
||||
comment = RDoc::Comment.new comment, @top_level, :c
|
||||
comment = new_comment comment, @top_level, :c
|
||||
comment.normalize
|
||||
|
||||
look_for_directives_in class_mod, comment
|
||||
@ -782,7 +782,7 @@ class RDoc::Parser::C < RDoc::Parser
|
||||
table[const_name] ||
|
||||
''
|
||||
|
||||
RDoc::Comment.new comment, @top_level, :c
|
||||
new_comment comment, @top_level, :c
|
||||
end
|
||||
|
||||
##
|
||||
@ -813,7 +813,7 @@ class RDoc::Parser::C < RDoc::Parser
|
||||
|
||||
return unless comment
|
||||
|
||||
RDoc::Comment.new comment, @top_level, :c
|
||||
new_comment comment, @top_level, :c
|
||||
end
|
||||
|
||||
##
|
||||
@ -947,7 +947,7 @@ class RDoc::Parser::C < RDoc::Parser
|
||||
|
||||
new_comment = "#{$1}#{new_comment.lstrip}"
|
||||
|
||||
new_comment = RDoc::Comment.new new_comment, @top_level, :c
|
||||
new_comment = self.new_comment(new_comment, @top_level, :c)
|
||||
|
||||
con = RDoc::Constant.new const_name, new_definition, new_comment
|
||||
else
|
||||
@ -1222,4 +1222,7 @@ class RDoc::Parser::C < RDoc::Parser
|
||||
@top_level
|
||||
end
|
||||
|
||||
def new_comment text = nil, location = nil, language = nil
|
||||
RDoc::Comment.new(text, location, language)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user