Skip to content

Commit f468e96

Browse files
authored
Merge pull request jruby#8537 from enebo/no_check
We should always have a valid staticScope
2 parents cd42dc1 + d5f48bd commit f468e96

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,15 +1659,15 @@ public static RubyHash dupKwargsHashAndPopulateFromArray(ThreadContext context,
16591659

16601660
@JIT
16611661
public static IRubyObject searchConst(ThreadContext context, StaticScope staticScope, String constName, boolean noPrivateConsts) {
1662-
RubyModule object = objectClass(context);
1663-
IRubyObject constant = staticScope == null ? object.getConstant(constName) : staticScope.getConstantInner(constName);
1662+
IRubyObject constant = staticScope.getConstantInner(constName);
16641663

16651664
// Inheritance lookup
16661665
RubyModule module = null;
16671666
if (constant == null) {
1668-
// SSS FIXME: Is this null check case correct?
1669-
module = staticScope == null ? object : staticScope.getModule();
1670-
constant = noPrivateConsts ? module.getConstantFromNoConstMissing(constName, false) : module.getConstantNoConstMissing(constName);
1667+
module = staticScope.getModule();
1668+
constant = noPrivateConsts ?
1669+
module.getConstantFromNoConstMissing(constName, false) :
1670+
module.getConstantNoConstMissing(constName);
16711671
}
16721672

16731673
// Call const_missing or cache

core/src/main/java/org/jruby/ir/targets/indy/ConstantLookupSite.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,17 @@ private RubySymbol getSymbolicName(ThreadContext context) {
8080

8181
public IRubyObject searchConst(ThreadContext context, StaticScope staticScope) {
8282
// Lexical lookup
83-
RubyModule object = objectClass(context);
84-
8583
// get switchpoint before value
8684
SwitchPoint switchPoint = getSwitchPointForConstant(context.runtime);
87-
IRubyObject constant = (staticScope == null) ? object.getConstant(name) : staticScope.getConstantInner(name);
85+
IRubyObject constant = staticScope.getConstantInner(name);
8886

8987
// Inheritance lookup
9088
RubyModule module = null;
9189
if (constant == null) {
92-
// SSS FIXME: Is this null check case correct?
93-
module = staticScope == null ? object : staticScope.getModule();
94-
constant = publicOnly ? module.getConstantFromNoConstMissing(name, false) : module.getConstantNoConstMissing(name);
90+
module = staticScope.getModule();
91+
constant = publicOnly ?
92+
module.getConstantFromNoConstMissing(name, false) :
93+
module.getConstantNoConstMissing(name);
9594
}
9695

9796
// Call const_missing or cache

core/src/main/java/org/jruby/ir/targets/simple/ConstantLookupSite.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ public ConstantLookupSite(RubySymbol name) {
2525

2626
private IRubyObject cacheSearchConst(ThreadContext context, StaticScope staticScope, boolean publicOnly) {
2727
// Lexical lookup
28-
RubyModule object = objectClass(context);
2928
String id = this.id;
30-
IRubyObject constant = (staticScope == null) ? object.getConstant(id) : staticScope.getConstantInner(id);
29+
IRubyObject constant = staticScope.getConstantInner(id);
3130

3231
// Inheritance lookup
3332
RubyModule module = null;
3433
if (constant == null) {
35-
// SSS FIXME: Is this null check case correct?
36-
module = staticScope == null ? object : staticScope.getModule();
37-
constant = publicOnly ? module.getConstantFromNoConstMissing(id, false) : module.getConstantNoConstMissing(id);
34+
module = staticScope.getModule();
35+
constant = publicOnly ?
36+
module.getConstantFromNoConstMissing(id, false) :
37+
module.getConstantNoConstMissing(id);
3838
}
3939

4040
// Call const_missing or cache

0 commit comments

Comments
 (0)