Skip to content

Commit

Permalink
[Truffle] Warn if using isModuleFunction on a Class.
Browse files Browse the repository at this point in the history
* In Ruby it should even be a NoMethodError.
  • Loading branch information
eregon committed Feb 16, 2015
1 parent a563d9c commit 6baf79e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ private static void addMethod(RubyClass rubyObjectClass, MethodDetails methodDet
if (anno.onSingleton()) {
System.err.println("WARNING: Either onSingleton or isModuleFunction for " + methodDetails.getIndicativeName());
}
if (!module.isOnlyAModule()) {
System.err.println("WARNING: Using isModuleFunction on a Class for " + methodDetails.getIndicativeName());
}
}

// Do not use needsSelf=true in module functions, it is either the module/class or the instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public RubyNilClass initialize(RubyEncodingConverter self, RubyString source, Ru

}

@CoreMethod(names = "search_convpath", isModuleFunction = true, needsSelf = false, required = 2)
@CoreMethod(names = "search_convpath", onSingleton = true, required = 2)
public abstract static class SearchConvPathNode extends CoreMethodNode {

public SearchConvPathNode(RubyContext context, SourceSection sourceSection) {
Expand Down

0 comments on commit 6baf79e

Please sign in to comment.