From cc2a16d94d744d14d4a5eb06eca22137f8a9b79e Mon Sep 17 00:00:00 2001 From: drbrain Date: Wed, 2 Feb 2011 00:32:30 +0000 Subject: Import RDoc 3.5.1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/context.rb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'lib/rdoc/context.rb') diff --git a/lib/rdoc/context.rb b/lib/rdoc/context.rb index c424ef1676..3c12d10058 100644 --- a/lib/rdoc/context.rb +++ b/lib/rdoc/context.rb @@ -188,7 +188,6 @@ class RDoc::Context < RDoc::CodeObject @in_files = [] @name ||= "unknown" - @comment ||= "" @parent = nil @visibility = :public @@ -440,10 +439,13 @@ class RDoc::Context < RDoc::CodeObject # HACK: avoid duplicate 'PI' & 'E' in math.c (1.8.7 source code) # (this is a #ifdef: should be handled by the C parser) known = @constants_hash[constant.name] - if known - #$stderr.puts "\nconstant #{constant.name} already registered" + + if known then known.comment = constant.comment if known.comment.empty? - known.value = constant.value if known.value.nil? or known.value.strip.empty? + + known.value = constant.value if + known.value.nil? or known.value.strip.empty? + known.is_alias_for ||= constant.is_alias_for else @constants_hash[constant.name] = constant @@ -495,9 +497,10 @@ class RDoc::Context < RDoc::CodeObject end ## - # Adds an alias from +from+ (a class or module) to +name+. + # Adds an alias from +from+ (a class or module) to +name+ which was defined + # in +file+. - def add_module_alias from, name + def add_module_alias from, name, file return from if @done_documenting to_name = child_name(name) @@ -519,7 +522,8 @@ class RDoc::Context < RDoc::CodeObject # HACK: register a constant for this alias: # constant value and comment will be updated after, # when the Ruby parser adds the constant - const = RDoc::Constant.new(name, nil, '') + const = RDoc::Constant.new name, nil, '' + const.record_location file const.is_alias_for = from add_constant const -- cgit v1.2.3