Skip to content
Permalink
Browse files
[Truffle] Document CoreMethod.onSingleton and isModuleFunction.
* Fix usage of them in ThreadNodes.
  • Loading branch information
eregon committed Oct 18, 2014
1 parent 9acd2fb commit 2a8dfe2fa3c67ced764f1c90cf8dfd7062014639
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
@@ -22,8 +22,17 @@

Visibility visibility() default Visibility.PUBLIC;

/**
* Defines the method on the singleton class.
* needsSelf is always false.
* */
boolean onSingleton() default false;

/**
* Defines the method as a public on the singleton class
* and as a private instance method.
* needsSelf is always false.
*/
boolean isModuleFunction() default false;

boolean needsSelf() default true;
@@ -43,7 +43,7 @@ public boolean alive(RubyThread thread) {

}

@CoreMethod(names = "current", isModuleFunction = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "current", onSingleton = true, maxArgs = 0)
public abstract static class CurrentNode extends CoreMethodNode {

public CurrentNode(RubyContext context, SourceSection sourceSection) {
@@ -63,7 +63,7 @@ public RubyThread current() {

}

@CoreMethod(names = "exit", isModuleFunction = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "exit", onSingleton = true, maxArgs = 0)
public abstract static class ExitModuleNode extends CoreMethodNode {

public ExitModuleNode(RubyContext context, SourceSection sourceSection) {
@@ -141,7 +141,7 @@ public RubyThread join(RubyThread self) {

}

@CoreMethod(names = "pass", needsSelf = false, isModuleFunction = true, maxArgs = 0)
@CoreMethod(names = "pass", onSingleton = true, maxArgs = 0)
public abstract static class PassNode extends CoreMethodNode {

public PassNode(RubyContext context, SourceSection sourceSection) {

0 comments on commit 2a8dfe2

Please sign in to comment.