Skip to content

Commit e5e43af

Browse files
nirvdrumparacycle
authored andcommitted
Rename backtraceName to originalName to better reflect its meaning.
Co-authored-by: Ufuk Kayserilioglu <[email protected]>
1 parent 06922c7 commit e5e43af

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

src/main/java/org/truffleruby/core/MainNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ protected Object mainUsing(Frame callerFrame, Object self, Object[] rubyArgs, Ro
7373

7474
@TruffleBoundary
7575
private boolean isCalledFromTopLevel(InternalMethod callerMethod) {
76-
final String name = callerMethod.getSharedMethodInfo().getBacktraceName();
76+
final String name = callerMethod.getSharedMethodInfo().getOriginalName();
7777
return name.equals("<main>") || name.startsWith("<top ");
7878
}
7979
}

src/main/java/org/truffleruby/core/method/UnboundMethodNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public abstract static class OriginalNameNode extends CoreMethodArrayArgumentsNo
153153
@Specialization
154154
protected RubySymbol originalName(RubyUnboundMethod unboundMethod,
155155
@Cached ToSymbolNode toSymbolNode) {
156-
String originalName = unboundMethod.method.getSharedMethodInfo().getBacktraceName();
156+
String originalName = unboundMethod.method.getSharedMethodInfo().getOriginalName();
157157

158158
return toSymbolNode.execute(originalName);
159159
}

src/main/java/org/truffleruby/core/proc/ProcNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public abstract static class ProcSymbolToProcSymbolNode extends PrimitiveArrayAr
286286
@Specialization
287287
protected Object symbolToProcSymbol(RubyProc proc) {
288288
if (proc.arity == SymbolNodes.ToProcNode.ARITY) {
289-
return getSymbol(proc.getSharedMethodInfo().getBacktraceName());
289+
return getSymbol(proc.getSharedMethodInfo().getOriginalName());
290290
} else {
291291
return nil;
292292
}

src/main/java/org/truffleruby/language/backtrace/Backtrace.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public static String labelFor(TruffleStackTraceElement e) {
151151
RootNode root = e.getTarget().getRootNode();
152152
String label = root instanceof RubyRootNode
153153
// Ruby backtraces do not include the class name for MRI compatibility.
154-
? ((RubyRootNode) root).getSharedMethodInfo().getBacktraceName()
154+
? ((RubyRootNode) root).getSharedMethodInfo().getOriginalName()
155155
: root.getName();
156156
return label == null ? "<unknown>" : label;
157157
}

src/main/java/org/truffleruby/language/methods/SharedMethodInfo.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public final class SharedMethodInfo {
3434
private final Arity arity;
3535
/** The original name of the method. Does not change when aliased. Looks like "block in foo" or "block (2 levels) in
3636
* foo" for blocks. This is the name shown in backtraces: "from FILE:LINE:in `NAME'". */
37-
private final String backtraceName;
37+
private final String originalName;
3838
/** The "static" name of this method at parse time, such as "M::C#foo", "M::C.foo", "<module:Inner>", "block (2
3939
* levels) in M::C.foo" or "block (2 levels) in <module:Inner>". This name is used for tools. */
4040
private final String parseName;
@@ -48,16 +48,16 @@ public SharedMethodInfo(
4848
SourceSection sourceSection,
4949
LexicalScope staticLexicalScope,
5050
Arity arity,
51-
String backtraceName,
51+
String originalName,
5252
int blockDepth,
5353
String parseName,
5454
String notes,
5555
ArgumentDescriptor[] argumentDescriptors) {
56-
assert blockDepth == 0 || backtraceName.startsWith("block ") : backtraceName;
56+
assert blockDepth == 0 || originalName.startsWith("block ") : originalName;
5757
this.sourceSection = sourceSection;
5858
this.staticLexicalScope = staticLexicalScope;
5959
this.arity = arity;
60-
this.backtraceName = backtraceName;
60+
this.originalName = originalName;
6161
this.blockDepth = blockDepth;
6262
this.parseName = parseName;
6363
this.notes = notes;
@@ -93,7 +93,7 @@ public SharedMethodInfo withArity(Arity newArity) {
9393
sourceSection,
9494
staticLexicalScope,
9595
newArity,
96-
backtraceName,
96+
originalName,
9797
blockDepth,
9898
parseName,
9999
notes,
@@ -131,7 +131,7 @@ public boolean isBlock() {
131131

132132
@TruffleBoundary
133133
public boolean isModuleBody() {
134-
boolean isModuleBody = isModuleBody(getBacktraceName());
134+
boolean isModuleBody = isModuleBody(getOriginalName());
135135
assert !(isModuleBody && isBlock()) : this;
136136
return isModuleBody;
137137
}
@@ -150,19 +150,19 @@ public static boolean isModuleBody(String name) {
150150
}
151151
}
152152

153-
public String getBacktraceName() {
154-
return backtraceName;
153+
public String getOriginalName() {
154+
return originalName;
155155
}
156156

157157
/** Returns the method name on its own. Can start with "<" like "<module:Inner>" for module bodies. */
158158
public String getMethodName() {
159-
return blockDepth == 0 ? backtraceName : notes;
159+
return blockDepth == 0 ? originalName : notes;
160160
}
161161

162162
/** More efficient than {@link #getMethodName()} when we know blockDepth == 0 */
163163
public String getMethodNameForNotBlock() {
164164
assert blockDepth == 0;
165-
return backtraceName;
165+
return originalName;
166166
}
167167

168168
public String getParseName() {

src/main/java/org/truffleruby/parser/BodyTranslator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,7 @@ private ModuleBodyDefinition compileClassNode(SourceIndexLength sourceSection, P
10791079
environment.getReturnID());
10801080

10811081
return new ModuleBodyDefinition(
1082-
environment.getSharedMethodInfo().getBacktraceName(),
1082+
environment.getSharedMethodInfo().getOriginalName(),
10831083
environment.getSharedMethodInfo(),
10841084
rootNode.getCallTarget(),
10851085
environment.getStaticLexicalScopeOrNull());
@@ -2006,14 +2006,14 @@ private RubyNode translateBlockLikeNode(IterParseNode node, boolean isStabbyLamb
20062006
final int blockDepth = environment.getBlockDepth() + 1;
20072007

20082008
// "block in foo"
2009-
String backtraceName = SharedMethodInfo.getBlockName(blockDepth, methodName);
2009+
String originalName = SharedMethodInfo.getBlockName(blockDepth, methodName);
20102010
// "block (2 levels) in M::C.foo"
20112011
String parseName = SharedMethodInfo.getBlockName(blockDepth, methodParent.getSharedMethodInfo().getParseName());
20122012
final SharedMethodInfo sharedMethodInfo = new SharedMethodInfo(
20132013
sourceSection.toSourceSection(source),
20142014
environment.getStaticLexicalScopeOrNull(),
20152015
argsNode.getArity(),
2016-
backtraceName,
2016+
originalName,
20172017
blockDepth,
20182018
parseName,
20192019
methodName,

0 commit comments

Comments
 (0)