Skip to content

Commit

Permalink
[Truffle] Improve SharedMethodInfo#toString() for core methods.
Browse files Browse the repository at this point in the history
* We reuse SharedMethodInfo.name, which for core methods should only be debug information.
  SharedMethodInfo.getName() is otherwise used by super, __method__, #eval but those
  are never called in core methods.
  • Loading branch information
eregon committed Oct 23, 2016
1 parent 12bfb90 commit 7c6780e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -168,7 +168,7 @@ private static void addMethod(RubyContext context, DynamicObject module, SharedM

private static SharedMethodInfo makeSharedMethodInfo(RubyContext context, MethodDetails methodDetails) {
final CoreMethod method = methodDetails.getMethodAnnotation();
final String methodName = method.names()[0];
final String methodName = methodDetails.getIndicativeName();

final int required = method.required();
final int optional = method.optional();
Expand Down
Expand Up @@ -107,17 +107,17 @@ public SharedMethodInfo withName(String newName) {
@Override
public String toString() {
final String prefix;

if (isBlock) {
prefix = "block in ";
} else {
prefix = "";
}

final String suffix;

if (sourceSection == null) {
suffix = name;
} else if (!sourceSection.isAvailable()) {
suffix = String.format("%s %s", name, sourceSection.getSource().getName());
} else {
suffix = String.format("%s %s:%d", name, sourceSection.getSource().getName(), sourceSection.getStartLine());
}
Expand Down

0 comments on commit 7c6780e

Please sign in to comment.