-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
[Truffle] Add NameError layout with receiver #4025
Conversation
@@ -0,0 +1,38 @@ | |||
/* | |||
* Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. This |
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.
If you didn't copy this code from somewhere else, it should probably just be 2016.
@nirvdrum Thanks, I've fixed the copyright and style issue |
|
||
} | ||
|
||
@Primitive(name = "exception_set_name") |
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.
name_error_set_name
since this only makes sense for name errors.
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.
There is unfortunately no automatic namespacing for primitives, it's a single flat namespace.
@eregon @chrisseaton I've re-ordered the receiver, name args and added a specialization in the allocate node for NameError, is there any better way to implement the guard there: |
@Specialization(guards = "isNameError(rubyClass)") | ||
public DynamicObject allocateNameError(DynamicObject rubyClass) { | ||
return allocateObjectNode.allocate(rubyClass, nil(), null, null, nil()); | ||
} |
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.
I would define this on NameError, not in Exception so there is no need for guards and it's automatically using the right one.
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.
So you'll need a NameErrorNodes.java, or define it in Ruby, invoking a primitive.
NameErrorNodes makes sense since it's not just one method.
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.
@eregon I've moved this specialization to NameErrorNodes
No description provided.