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

Add Set#reset #4957

Merged
merged 1 commit into from Jan 10, 2018
Merged

Add Set#reset #4957

merged 1 commit into from Jan 10, 2018

Conversation

ChrisBr
Copy link
Contributor

@ChrisBr ChrisBr commented Jan 8, 2018

@ChrisBr
Copy link
Contributor Author

ChrisBr commented Jan 8, 2018

Please note that the test will fail because of this issue
#4958

if (tmp.isNil()) {
modifyCheck(context.runtime);
} else {
System.out.println("rehash");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✂️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢

@@ -875,6 +876,18 @@ public IRubyObject op_equal(ThreadContext context, IRubyObject other) {
return context.runtime.getFalse();
}

@JRubyMethod(name = "reset")
public IRubyObject reset(ThreadContext context) {
IRubyObject tmp = TypeConverter.checkHashType(context.runtime, this.hash);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.hash is 'internal' -> can not be changed (wout hacks) on .rb end ... + its already of type RubyHash

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I understand correct :/ What should I use instead this.hash.
The type check is adapted from the MRI implementation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type check is adapted from the MRI implementation.

figured, since this as a native part, specific to JRuby, just logically simplify what makes sense.
since you have a RubyHash hash you do not need any type-checking whether its a Hash ...

@kares kares added this to the JRuby 9.3.0.0 milestone Jan 9, 2018
@ChrisBr ChrisBr force-pushed the feature/set-rehash branch 2 times, most recently from 0c36854 to 5f7e117 Compare January 9, 2018 10:55
@kares
Copy link
Member

kares commented Jan 10, 2018

Thanks Chris, well done!

@kares kares merged commit 1b99cd3 into jruby:ruby-2.5 Jan 10, 2018
@enebo enebo modified the milestones: JRuby 9.3.0.0, JRuby 9.2.0.0 Apr 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants