Skip to content

Commit

Permalink
[Truffle] Document CoreMethod.onSingleton and isModuleFunction.
Browse files Browse the repository at this point in the history
* Fix usage of them in ThreadNodes.
  • Loading branch information
eregon committed Oct 18, 2014
1 parent 9acd2fb commit 2a8dfe2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Expand Up @@ -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;
Expand Down
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 2a8dfe2

Please sign in to comment.