From 17606d8af7daa7f3a25d1eeae9e925955289e417 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Fri, 24 Jul 2015 01:24:45 +0200 Subject: [PATCH] ruby: Fix scope after anonymous classes --- tagmanager/ctags/ruby.c | 3 +++ tests/ctags/Makefile.am | 1 + tests/ctags/ruby-scope-after-anonymous-class.rb | 10 ++++++++++ tests/ctags/ruby-scope-after-anonymous-class.rb.tags | 4 ++++ 4 files changed, 18 insertions(+) create mode 100644 tests/ctags/ruby-scope-after-anonymous-class.rb create mode 100644 tests/ctags/ruby-scope-after-anonymous-class.rb.tags diff --git a/tagmanager/ctags/ruby.c b/tagmanager/ctags/ruby.c index f9a987bd2..02c12c6dc 100644 --- a/tagmanager/ctags/ruby.c +++ b/tagmanager/ctags/ruby.c @@ -49,6 +49,8 @@ static stringList* nesting = NULL; * FUNCTION DEFINITIONS */ +static void enterUnnamedScope (void); + /* * Returns a string describing the scope in 'list'. * We record the current scope as a list of entered scopes. @@ -341,6 +343,7 @@ static void readAndEmitTag (const unsigned char** cp, rubyKind expected_kind) * * For now, we don't create any. */ + enterUnnamedScope (); } else { diff --git a/tests/ctags/Makefile.am b/tests/ctags/Makefile.am index c06701249..23d1bfbb7 100644 --- a/tests/ctags/Makefile.am +++ b/tests/ctags/Makefile.am @@ -258,6 +258,7 @@ test_sources = \ ruby-block-call.rb \ ruby-doc.rb \ ruby-namespaced-class.rb \ + ruby-scope-after-anonymous-class.rb \ ruby-sf-bug-364.rb \ rules.t2t \ sample.t2t \ diff --git a/tests/ctags/ruby-scope-after-anonymous-class.rb b/tests/ctags/ruby-scope-after-anonymous-class.rb new file mode 100644 index 000000000..377b616df --- /dev/null +++ b/tests/ctags/ruby-scope-after-anonymous-class.rb @@ -0,0 +1,10 @@ +class C + class << self + def foo() end + end + + def bar(); end +end + +puts C.foo +puts C.new.bar diff --git a/tests/ctags/ruby-scope-after-anonymous-class.rb.tags b/tests/ctags/ruby-scope-after-anonymous-class.rb.tags new file mode 100644 index 000000000..8d671fe8b --- /dev/null +++ b/tests/ctags/ruby-scope-after-anonymous-class.rb.tags @@ -0,0 +1,4 @@ +# format=tagmanager +CÌ1Ö0 +barÌ128ÎCÖ0 +fooÌ128ÎCÖ0 -- 2.11.4.GIT