Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby: fix a typo in accessing elements in the mixin spec array #2482

Merged
merged 1 commit into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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