-
Notifications
You must be signed in to change notification settings - Fork 188
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
Improve MatchData#dup #1792
Improve MatchData#dup #1792
Conversation
Is there anything that relies on |
|
||
public class MatchDataGuards { | ||
public static boolean isInitialized(DynamicObject matchData) { | ||
return Layouts.MATCH_DATA.getRegexp(matchData) != null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you check getSource(matchData) != null
here?
getRegexp()
can already return multiple kinds of values (see comment).
@TruffleBoundary | ||
@Specialization | ||
protected DynamicObject allocate(DynamicObject rubyClass) { | ||
throw new RaiseException(getContext(), coreExceptions().typeErrorAllocatorUndefinedFor(rubyClass, this)); | ||
protected DynamicObject allocate(DynamicObject rubyClass, @Cached AllocateObjectNode allocateNode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Cached
should be on its own line (jt checkstyle
checks that)
The goal for this was to get Don't really have a strong opinion on this either way, just following MRI here. One thing to note is that there is no specs to make sure |
Indeed, that's how MRI does it, and it's generally good to follow MRI behavior for maximum compatibility.
I think it would make the changes more localized, by just having to implement
I think those specs are less necessary with your approach, there we can rely on Kernel#{dup,clone} specs. I'll merge this approach, it's straightforward and aims for maximum compatibility with MRI. |
MRI issue to discuss whether we can make MatchData frozen: |
PullRequest: truffleruby/1116
Nobu made |
What we can do here is leave |
I did that in 32791da. |
Authored by @XrXr.
Shopify#1