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.

# Conflicts:
#	core/src/main/java/org/jruby/ir/interpreter/Interpreter.java
  • Loading branch information
enebo committed Jun 14, 2018
1 parent 3b448cc commit 6bdc55f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/ir/interpreter/Interpreter.java
Expand Up @@ -33,7 +33,8 @@

public class Interpreter extends IRTranslator<IRubyObject, IRubyObject> {
public 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 6bdc55f

Please sign in to comment.