Skip to content

Instantly share code, notes, and snippets.

@headius

headius/.diff Secret

Created March 2, 2023 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/92600725a89287189b2dc71a3d01747c to your computer and use it in GitHub Desktop.
Save headius/92600725a89287189b2dc71a3d01747c to your computer and use it in GitHub Desktop.
diff --git a/core/src/main/java/org/jruby/RubyKernel.java b/core/src/main/java/org/jruby/RubyKernel.java
index d1751cd3d1..02084fa8a3 100644
--- a/core/src/main/java/org/jruby/RubyKernel.java
+++ b/core/src/main/java/org/jruby/RubyKernel.java
@@ -1173,7 +1173,7 @@ public class RubyKernel {
}
// set method to current frame's, which should be caller's
- String frameName = context.getFrameName();
+ String frameName = context.getCompositeName();
if (frameName != null) binding.setMethod(frameName);
if (bindingGiven) recv = binding.getSelf();
@@ -2049,7 +2049,7 @@ public class RubyKernel {
@JRubyMethod(name = { "__method__" }, module = true, visibility = PRIVATE, reads = METHODNAME, omit = true)
public static IRubyObject __method__(ThreadContext context, IRubyObject recv) {
- String frameName = context.getSuperName();
+ String frameName = context.getFrameName();
if (frameName == null || frameName == Ruby.ROOT_FRAME_NAME) {
return context.nil;
}
diff --git a/core/src/main/java/org/jruby/RubyObject.java b/core/src/main/java/org/jruby/RubyObject.java
index c2375f0af7..7c8d6216af 100644
--- a/core/src/main/java/org/jruby/RubyObject.java
+++ b/core/src/main/java/org/jruby/RubyObject.java
@@ -49,7 +49,6 @@ import java.util.Set;
import org.jruby.anno.JRubyClass;
import org.jruby.runtime.Block;
import org.jruby.runtime.ClassIndex;
-import org.jruby.runtime.JavaSites;
import org.jruby.runtime.JavaSites.ObjectSites;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
@@ -344,7 +343,7 @@ public class RubyObject extends RubyBasicObject {
if (args.length == 0) {
throw getRuntime().newArgumentError("block not supplied");
} else if (args.length > 3) {
- String lastFuncName = context.getSuperName();
+ String lastFuncName = context.getFrameName();
throw getRuntime().newArgumentError(
"wrong number of arguments: " + lastFuncName + "(src) or " + lastFuncName + "{..}");
}
diff --git a/core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java b/core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
index 65bc457407..ad8e4aff22 100644
--- a/core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
+++ b/core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
@@ -991,7 +991,7 @@ public class IRRuntimeHelpers {
@Interp
public static IRubyObject isDefinedSuper(ThreadContext context, IRubyObject receiver, IRubyObject definedMessage) {
- return isDefinedSuper(context, receiver, context.getSuperName(), context.getFrameKlazz(), definedMessage);
+ return isDefinedSuper(context, receiver, context.getFrameName(), context.getFrameKlazz(), definedMessage);
}
@JIT
@@ -1413,7 +1413,7 @@ public class IRRuntimeHelpers {
public static IRubyObject unresolvedSuper(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) {
// We have to rely on the frame stack to find the implementation class
RubyModule klazz = context.getFrameKlazz();
- String methodName = context.getSuperName();
+ String methodName = context.getFrameName();
Helpers.checkSuperDisabledOrOutOfMethod(context, klazz, methodName);
diff --git a/core/src/main/java/org/jruby/runtime/Helpers.java b/core/src/main/java/org/jruby/runtime/Helpers.java
index 7c5c54a043..467180ad3e 100644
--- a/core/src/main/java/org/jruby/runtime/Helpers.java
+++ b/core/src/main/java/org/jruby/runtime/Helpers.java
@@ -59,7 +59,6 @@ import org.jruby.ir.JIT;
import org.jruby.ir.operands.UndefinedValue;
import org.jruby.ir.runtime.IRRuntimeHelpers;
import org.jruby.javasupport.Java;
-import org.jruby.javasupport.JavaClass;
import org.jruby.javasupport.JavaUtil;
import org.jruby.javasupport.proxy.ReifiedJavaProxy;
import org.jruby.parser.StaticScope;
@@ -81,7 +80,6 @@ import org.jcodings.specific.USASCIIEncoding;
import org.jcodings.specific.UTF8Encoding;
import org.jcodings.unicode.UnicodeEncoding;
-import static org.jruby.RubyBasicObject.UNDEF;
import static org.jruby.RubyBasicObject.getMetaClass;
import static org.jruby.runtime.ThreadContext.CALL_KEYWORD_EMPTY;
import static org.jruby.runtime.Visibility.*;
@@ -723,7 +721,7 @@ public class Helpers {
* invoking.
*/
public static IRubyObject invokeSuper(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) {
- return invokeSuper(context, self, context.getFrameKlazz(), context.getSuperName(), args, block);
+ return invokeSuper(context, self, context.getFrameKlazz(), context.getFrameName(), args, block);
}
public static String getSuperNameFromFrameName(String frameName) {
@@ -773,7 +771,7 @@ public class Helpers {
public static IRubyObject invokeSuper(ThreadContext context, IRubyObject self, Block block) {
checkSuperDisabledOrOutOfMethod(context);
RubyModule klazz = context.getFrameKlazz();
- String name = context.getSuperName();
+ String name = context.getFrameName();
RubyClass selfClass = getMetaClass(self);
RubyClass superClass = klazz.getSuperClass();
@@ -789,7 +787,7 @@ public class Helpers {
public static IRubyObject invokeSuper(ThreadContext context, IRubyObject self, IRubyObject arg0, Block block) {
checkSuperDisabledOrOutOfMethod(context);
RubyModule klazz = context.getFrameKlazz();
- String name = context.getSuperName();
+ String name = context.getFrameName();
RubyClass selfClass = getMetaClass(self);
RubyClass superClass = klazz.getSuperClass();
@@ -805,7 +803,7 @@ public class Helpers {
public static IRubyObject invokeSuper(ThreadContext context, IRubyObject self, IRubyObject arg0, IRubyObject arg1, Block block) {
checkSuperDisabledOrOutOfMethod(context);
RubyModule klazz = context.getFrameKlazz();
- String name = context.getSuperName();
+ String name = context.getFrameName();
RubyClass selfClass = getMetaClass(self);
RubyClass superClass = klazz.getSuperClass();
@@ -821,7 +819,7 @@ public class Helpers {
public static IRubyObject invokeSuper(ThreadContext context, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) {
checkSuperDisabledOrOutOfMethod(context);
RubyModule klazz = context.getFrameKlazz();
- String name = context.getSuperName();
+ String name = context.getFrameName();
RubyClass selfClass = getMetaClass(self);
RubyClass superClass = klazz.getSuperClass();
@@ -1209,7 +1207,7 @@ public class Helpers {
}
public static void checkSuperDisabledOrOutOfMethod(ThreadContext context) {
- checkSuperDisabledOrOutOfMethod(context, context.getFrameKlazz(), context.getSuperName());
+ checkSuperDisabledOrOutOfMethod(context, context.getFrameKlazz(), context.getFrameName());
}
public static void checkSuperDisabledOrOutOfMethod(ThreadContext context, RubyModule klass, String name) {
diff --git a/core/src/main/java/org/jruby/runtime/ThreadContext.java b/core/src/main/java/org/jruby/runtime/ThreadContext.java
index a9ac4d3aba..2f4966c8bd 100644
--- a/core/src/main/java/org/jruby/runtime/ThreadContext.java
+++ b/core/src/main/java/org/jruby/runtime/ThreadContext.java
@@ -74,7 +74,6 @@ import java.lang.ref.WeakReference;
import java.security.SecureRandom;
import java.util.HashMap;
import java.util.IdentityHashMap;
-import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.stream.IntStream;
@@ -730,11 +729,11 @@ public final class ThreadContext {
return false;
}
- public String getFrameName() {
+ public String getCompositeName() {
return getCurrentFrame().getName();
}
- public String getSuperName() {
+ public String getFrameName() {
return Helpers.getSuperNameFromFrameName(getCurrentFrame().getName());
}
diff --git a/core/src/main/java/org/jruby/runtime/backtrace/TraceType.java b/core/src/main/java/org/jruby/runtime/backtrace/TraceType.java
index 9dfe7fedb0..a012228e8a 100644
--- a/core/src/main/java/org/jruby/runtime/backtrace/TraceType.java
+++ b/core/src/main/java/org/jruby/runtime/backtrace/TraceType.java
@@ -3,7 +3,6 @@ package org.jruby.runtime.backtrace;
import java.io.ByteArrayOutputStream;
import java.io.FileDescriptor;
import java.io.PrintStream;
-import java.util.Arrays;
import java.util.stream.Stream;
import com.headius.backport9.stack.StackWalker;
@@ -531,9 +530,9 @@ public class TraceType {
private static void printErrorPos(ThreadContext context, PrintStream errorStream) {
if (context.getFile() != null && context.getFile().length() > 0) {
- if (context.getSuperName() != null) {
+ if (context.getFrameName() != null) {
errorStream.print(context.getFile() + ':' + context.getLine());
- errorStream.print(":in '" + context.getSuperName() + '\'');
+ errorStream.print(":in '" + context.getFrameName() + '\'');
} else if (context.getLine() != 0) {
errorStream.print(context.getFile() + ':' + context.getLine());
} else {
diff --git a/core/src/main/java/org/jruby/runtime/callsite/SuperCallSite.java b/core/src/main/java/org/jruby/runtime/callsite/SuperCallSite.java
index dc17657f03..a552a20c88 100644
--- a/core/src/main/java/org/jruby/runtime/callsite/SuperCallSite.java
+++ b/core/src/main/java/org/jruby/runtime/callsite/SuperCallSite.java
@@ -45,7 +45,7 @@ public class SuperCallSite extends CallSite {
public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject... args) {
RubyModule klazz = context.getFrameKlazz();
- String name = context.getSuperName();
+ String name = context.getFrameName();
return call(context, caller, self, klazz, name, args);
}
@@ -62,7 +62,7 @@ public class SuperCallSite extends CallSite {
public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject[] args, Block block) {
RubyModule klazz = context.getFrameKlazz();
- String name = context.getSuperName();
+ String name = context.getFrameName();
return call(context, caller, self, klazz, name, args, block);
}
@@ -155,7 +155,7 @@ public class SuperCallSite extends CallSite {
public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self) {
RubyModule klazz = context.getFrameKlazz();
- String name = context.getSuperName();
+ String name = context.getFrameName();
return call(context, caller, self, klazz, name);
}
@@ -172,7 +172,7 @@ public class SuperCallSite extends CallSite {
public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, Block block) {
RubyModule klazz = context.getFrameKlazz();
- String name = context.getSuperName();
+ String name = context.getFrameName();
return call(context, caller, self, klazz, name, block);
}
@@ -205,7 +205,7 @@ public class SuperCallSite extends CallSite {
public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg1) {
RubyModule klazz = context.getFrameKlazz();
- String name = context.getSuperName();
+ String name = context.getFrameName();
return call(context, caller, self, klazz, name, arg1);
}
@@ -222,7 +222,7 @@ public class SuperCallSite extends CallSite {
public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg1, Block block) {
RubyModule klazz = context.getFrameKlazz();
- String name = context.getSuperName();
+ String name = context.getFrameName();
return call(context, caller, self, klazz, name, arg1, block);
}
@@ -255,7 +255,7 @@ public class SuperCallSite extends CallSite {
public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg1, IRubyObject arg2) {
RubyModule klazz = context.getFrameKlazz();
- String name = context.getSuperName();
+ String name = context.getFrameName();
return call(context, caller, self, klazz, name, arg1, arg2);
}
@@ -272,7 +272,7 @@ public class SuperCallSite extends CallSite {
public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg1, IRubyObject arg2, Block block) {
RubyModule klazz = context.getFrameKlazz();
- String name = context.getSuperName();
+ String name = context.getFrameName();
return call(context, caller, self, klazz, name, arg1, arg2, block);
}
@@ -305,7 +305,7 @@ public class SuperCallSite extends CallSite {
public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) {
RubyModule klazz = context.getFrameKlazz();
- String name = context.getSuperName();
+ String name = context.getFrameName();
return call(context, caller, self, klazz, name, arg1, arg2, arg3);
}
@@ -322,7 +322,7 @@ public class SuperCallSite extends CallSite {
public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, Block block) {
RubyModule klazz = context.getFrameKlazz();
- String name = context.getSuperName();
+ String name = context.getFrameName();
return call(context, caller, self, klazz, name, arg1, arg2, arg3, block);
}
diff --git a/core/src/main/java/org/jruby/util/MRIRecursionGuard.java b/core/src/main/java/org/jruby/util/MRIRecursionGuard.java
index 61d19f7970..263546c1ed 100644
--- a/core/src/main/java/org/jruby/util/MRIRecursionGuard.java
+++ b/core/src/main/java/org/jruby/util/MRIRecursionGuard.java
@@ -119,7 +119,7 @@ public class MRIRecursionGuard {
private IRubyObject recursiveListAccess() {
Map<String, RubyHash> hash = recursive.get();
- String sym = runtime.getCurrentContext().getSuperName();
+ String sym = runtime.getCurrentContext().getFrameName();
IRubyObject list = runtime.getNil();
if(hash == null) {
hash = new HashMap<>();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment