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

[Truffle] Add NameError layout with receiver #4025

Merged
merged 5 commits into from
Jul 23, 2016

Conversation

bjfish
Copy link
Contributor

@bjfish bjfish commented Jul 21, 2016

No description provided.

@bjfish bjfish added the truffle label Jul 21, 2016
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. This
Copy link
Contributor

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.

@bjfish
Copy link
Contributor Author

bjfish commented Jul 21, 2016

@nirvdrum Thanks, I've fixed the copyright and style issue


}

@Primitive(name = "exception_set_name")
Copy link
Member

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.

Copy link
Member

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.

@bjfish
Copy link
Contributor Author

bjfish commented Jul 22, 2016

@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: public static boolean isNameError(DynamicObject rubyClass) ?

@Specialization(guards = "isNameError(rubyClass)")
public DynamicObject allocateNameError(DynamicObject rubyClass) {
return allocateObjectNode.allocate(rubyClass, nil(), null, null, nil());
}
Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

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

@eregon eregon merged commit 5399dcc into master Jul 23, 2016
@eregon eregon deleted the truffle-name-error-layout-with-receiver branch July 23, 2016 12:03
@enebo enebo modified the milestone: truffle-dev Aug 26, 2016
@enebo enebo added this to the Invalid or Duplicate milestone Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants