From 989bfe12d0566ab2357443d97cc25b7d34148c40 Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Fri, 3 Nov 2023 16:39:07 -0500 Subject: [PATCH] Reduce duplicate code for getting variable --- .../java/org/jruby/internal/runtime/GlobalVariables.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/src/main/java/org/jruby/internal/runtime/GlobalVariables.java b/core/src/main/java/org/jruby/internal/runtime/GlobalVariables.java index 441e8784d26..ee4d5f5fc14 100644 --- a/core/src/main/java/org/jruby/internal/runtime/GlobalVariables.java +++ b/core/src/main/java/org/jruby/internal/runtime/GlobalVariables.java @@ -122,10 +122,7 @@ public GlobalVariable getVariable(String name) { } public IRubyObject set(String name, IRubyObject value) { - assert name != null; - assert name.startsWith("$"); - - GlobalVariable variable = createIfNotDefined(name); + GlobalVariable variable = getVariable(name); IRubyObject result = variable.getAccessor().setValue(value); variable.trace(value); variable.invalidate();