Skip to content

Commit

Permalink
Ruby: fix a typo in accessing elements in the mixin spec array
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed Apr 2, 2020
1 parent 7d81c52 commit 999a44a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Units/parser-ruby.r/ruby-mixin-field.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ X input.rb /^module X$/;" m
hi input.rb /^ def hi$/;" f module:X
Y input.rb /^module Y$/;" m
hoi input.rb /^ def hoi$/;" f module:Y
Z input.rb /^module Z$/;" m
zoo input.rb /^ def zoo$/;" f module:Z
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
Expand All @@ -10,7 +12,7 @@ C input.rb /^class C$/;" c mixin:prepend:X,prepend:Y
hi input.rb /^ def hi$/;" f class:C
D input.rb /^class D$/;" c mixin:prepend:X
prep input.rb /^ def self.prep$/;" S class:D
E input.rb /^class E$/;" c mixin:extend:X,extend:Y
E input.rb /^class E$/;" c mixin:extend:X,extend:Y,extend:Z
hi input.rb /^ def hi$/;" f class:E
F input.rb /^class F$/;" c mixin:extend:X
prep input.rb /^ def self.prep$/;" S class:F
7 changes: 7 additions & 0 deletions Units/parser-ruby.r/ruby-mixin-field.d/input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ def hoi
end
end

module Z
def zoo
p "Calling 'zoo' in Z."
end
end

class A
include X
def hi
Expand Down Expand Up @@ -46,6 +52,7 @@ def hi
p "Calling 'hi' in E."
end
extend Y
extend Z
end

class F
Expand Down
2 changes: 1 addition & 1 deletion parsers/ruby.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ static void attachMixinField (int corkIndex, stringList *mixinSpec)
for (unsigned int i = 1; i < stringListCount (mixinSpec); i++)
{
vStringPut (mixinField, ',');
vStringCat (mixinField, stringListItem (mixinSpec, 1));
vStringCat (mixinField, stringListItem (mixinSpec, i));
}

attachParserFieldToCorkEntry (corkIndex, RubyFields [F_MIXIN].ftype,
Expand Down

0 comments on commit 999a44a

Please sign in to comment.