diff --git a/Units/parser-ruby.r/ruby-mixin-field.d/expected.tags b/Units/parser-ruby.r/ruby-mixin-field.d/expected.tags index bf91b765c6..e11479eeca 100644 --- a/Units/parser-ruby.r/ruby-mixin-field.d/expected.tags +++ b/Units/parser-ruby.r/ruby-mixin-field.d/expected.tags @@ -4,3 +4,5 @@ Y input.rb /^module Y$/;" m hoi input.rb /^ def hoi$/;" f module:Y A input.rb /^class A$/;" c mixin:include:X,include:Y hi input.rb /^ def hi$/;" f class:A +B input.rb /^class B$/;" c mixin:include:X +prep input.rb /^ def self.prep$/;" S class:B diff --git a/Units/parser-ruby.r/ruby-mixin-field.d/input.rb b/Units/parser-ruby.r/ruby-mixin-field.d/input.rb index ca6454bea0..d1d8d0a3c2 100644 --- a/Units/parser-ruby.r/ruby-mixin-field.d/input.rb +++ b/Units/parser-ruby.r/ruby-mixin-field.d/input.rb @@ -19,3 +19,9 @@ def hi end include Y end + +class B + def self.prep + include X + end +end diff --git a/parsers/ruby.c b/parsers/ruby.c index 903e27a796..31921f9f7e 100644 --- a/parsers/ruby.c +++ b/parsers/ruby.c @@ -465,6 +465,14 @@ static void readAndStoreMixinSpec (const unsigned char** cp, const char *how_mix NestingLevel *nl = nestingLevelsGetCurrent (nesting); tagEntryInfo *e = getEntryOfNestingLevel (nl); + if (e->kindIndex == K_SINGLETON) + { + nl = nestingLevelsGetNth (nesting, nesting->n - 2); + if (nl == NULL) + return; + e = getEntryOfNestingLevel (nl); + } + if (! (e->kindIndex == K_CLASS || e->kindIndex == K_MODULE)) return;