Skip to content

Commit

Permalink
Fixes #5164. Thread::Backtrace::Location#label inside eval does not r…
Browse files Browse the repository at this point in the history
…eturn enclosing method name.

This one is pretty weird.  I just switched to method.name from <eval> and the
test ran fine.  I noticed that top-level evals were not printing out <main>, so
I tweaked a few things.  JIT will apparently set frame method name to '' vs
null so I am not sure what is up there.
  • Loading branch information
enebo committed Jun 14, 2018
1 parent a60b38d commit da1b6c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Expand Up @@ -35,7 +35,7 @@ public class Interpreter extends IRTranslator<IRubyObject, IRubyObject> {

static final Logger LOG = LoggerFactory.getLogger(Interpreter.class);

public static final String ROOT = "(root)";
public static final String ROOT = "<main>";
static int interpInstrsCount = 0;

public static void dumpStats() {
Expand Down
Expand Up @@ -133,7 +133,9 @@ private RubyStackTraceElement[] constructBacktrace(Map<String, Map<String, Strin
case MODULE: newName = "<module:" + rubyFrame.method + '>'; break;
case METACLASS: newName = "singleton class"; break;
case ROOT: newName = "<main>"; break;
case EVAL: newName = "<eval>"; break;
case EVAL:
newName = rubyFrame.method == null || rubyFrame.method.isEmpty() ? "<main>" : rubyFrame.method;
break;
default: newName = rubyFrame.method;
}
RubyStackTraceElement rubyElement = new RubyStackTraceElement("RUBY", newName, rubyFrame.filename, rubyFrame.line + 1, false, frameType);
Expand Down

0 comments on commit da1b6c9

Please sign in to comment.