From 00131e9af6d80178aa4c7dcd1bff2a4fd2bbc7bd Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Fri, 3 Nov 2023 16:45:01 -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 c74d6c233404..449158026de7 100644 --- a/core/src/main/java/org/jruby/internal/runtime/GlobalVariables.java +++ b/core/src/main/java/org/jruby/internal/runtime/GlobalVariables.java @@ -123,10 +123,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();