diff options
author | dave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-05-03 00:49:33 +0000 |
---|---|---|
committer | dave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-05-03 00:49:33 +0000 |
commit | 47feb257047f4514e6e4dd09a7abb2fb6a30cbfe (patch) | |
tree | 50ebb0ec6076c51e1f2dc227b76b9fdea3578efa /lib | |
parent | 6303dc4cc1af1b97df737c35e502d77e063ec50b (diff) |
Fix parsing problem with yield within block
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rdoc/code_objects.rb | 7 | ||||
-rw-r--r-- | lib/rdoc/parsers/parse_rb.rb | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/rdoc/code_objects.rb b/lib/rdoc/code_objects.rb index a60affb7de..1d2e4d2129 100644 --- a/lib/rdoc/code_objects.rb +++ b/lib/rdoc/code_objects.rb @@ -195,7 +195,7 @@ module RDoc end def add_alias(an_alias) - meth = find_method_named(an_alias.old_name) + meth = find_instance_method_named(an_alias.old_name) if meth new_meth = AnyMethod.new(an_alias.text, an_alias.new_name) new_meth.is_alias_for = meth @@ -380,6 +380,11 @@ module RDoc @method_list.find {|meth| meth.name == name} end + # Find a named instance method, or return nil + def find_instance_method_named(name) + @method_list.find {|meth| meth.name == name && !meth.singleton} + end + # Find a named constant, or return nil def find_constant_named(name) @constants.find {|m| m.name == name} diff --git a/lib/rdoc/parsers/parse_rb.rb b/lib/rdoc/parsers/parse_rb.rb index 42e942ca38..6876cfe0fc 100644 --- a/lib/rdoc/parsers/parse_rb.rb +++ b/lib/rdoc/parsers/parse_rb.rb @@ -2020,6 +2020,8 @@ module RDoc when TkLBRACE nest += 1 when TkRBRACE + # we might have a.each {|i| yield i } + unget_tk(tk) if nest.zero? nest -= 1 break if nest <= 0 when TkLPAREN, TkfLPAREN |