Skip to content

Commit 200ce6e

Browse files
committed
Add a useful toString() for Ruby*SourceNode and RubyCallNode
1 parent d84da65 commit 200ce6e

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/main/java/org/truffleruby/language/RubyContextSourceNode.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,10 @@ public RubyContext getContext() {
7272

7373
return contextReference.get();
7474
}
75+
76+
@Override
77+
public String toString() {
78+
return super.toString() + " at " + RubyContext.fileLine(getSourceSection());
79+
}
80+
7581
}

src/main/java/org/truffleruby/language/RubySourceNode.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,9 @@ public Object isDefined(VirtualFrame frame, RubyContext context) {
3232
return RubyNode.defaultIsDefined(context, this);
3333
}
3434

35+
@Override
36+
public String toString() {
37+
return super.toString() + " at " + RubyContext.fileLine(getSourceSection());
38+
}
39+
3540
}

src/main/java/org/truffleruby/language/dispatch/RubyCallNode.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import com.oracle.truffle.api.profiles.ConditionProfile;
3232
import org.truffleruby.language.methods.LookupMethodOnSelfNode;
3333

34+
import java.util.Map;
35+
3436
import static org.truffleruby.language.dispatch.DispatchConfiguration.PRIVATE;
3537
import static org.truffleruby.language.dispatch.DispatchConfiguration.PRIVATE_RETURN_MISSING;
3638
import static org.truffleruby.language.dispatch.DispatchConfiguration.PROTECTED;
@@ -173,6 +175,13 @@ public boolean hasLiteralBlock() {
173175
return hasLiteralBlock;
174176
}
175177

178+
@Override
179+
public Map<String, Object> getDebugProperties() {
180+
final Map<String, Object> map = super.getDebugProperties();
181+
map.put("methodName", methodName);
182+
return map;
183+
}
184+
176185
private class DefinedNode extends RubyBaseNode {
177186

178187
private final RubySymbol methodNameSymbol = getContext().getSymbol(methodName);

0 commit comments

Comments
 (0)