Skip to content

Commit 7554ac6

Browse files
committed
We should always have a staticScope in hand
1 parent 4e925df commit 7554ac6

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

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

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

16601660
@JIT
16611661
public static IRubyObject searchConst(ThreadContext context, StaticScope staticScope, String constName, boolean noPrivateConsts) {
1662+
<<<<<<< Updated upstream
16621663
RubyModule object = objectClass(context);
16631664
IRubyObject constant = staticScope == null ? object.getConstant(constName) : staticScope.getConstantInner(constName);
1665+
=======
1666+
IRubyObject constant = staticScope.getScopedConstant(context, constName);
1667+
>>>>>>> Stashed changes
16641668

16651669
// Inheritance lookup
16661670
RubyModule module = null;
16671671
if (constant == null) {
1672+
<<<<<<< Updated upstream
16681673
// SSS FIXME: Is this null check case correct?
16691674
module = staticScope == null ? object : staticScope.getModule();
16701675
constant = noPrivateConsts ? module.getConstantFromNoConstMissing(constName, false) : module.getConstantNoConstMissing(constName);
1676+
=======
1677+
module = staticScope.getModule();
1678+
constant = noPrivateConsts ?
1679+
module.getConstantFromNoConstMissing(constName, false) :
1680+
module.getConstantNoConstMissing(context, constName);
1681+
>>>>>>> Stashed changes
16711682
}
16721683

16731684
// Call const_missing or cache

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

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

8181
public IRubyObject searchConst(ThreadContext context, StaticScope staticScope) {
8282
// Lexical lookup
83+
<<<<<<< Updated upstream
8384
RubyModule object = objectClass(context);
8485

8586
// get switchpoint before value
8687
SwitchPoint switchPoint = getSwitchPointForConstant(context.runtime);
8788
IRubyObject constant = (staticScope == null) ? object.getConstant(name) : staticScope.getConstantInner(name);
89+
=======
90+
// get switchpoint before value
91+
SwitchPoint switchPoint = getSwitchPointForConstant(context.runtime);
92+
IRubyObject constant = staticScope.getScopedConstant(context, name);
93+
>>>>>>> Stashed changes
8894

8995
// Inheritance lookup
9096
RubyModule module = null;
9197
if (constant == null) {
98+
<<<<<<< Updated upstream
9299
// SSS FIXME: Is this null check case correct?
93100
module = staticScope == null ? object : staticScope.getModule();
94101
constant = publicOnly ? module.getConstantFromNoConstMissing(name, false) : module.getConstantNoConstMissing(name);
102+
=======
103+
module = staticScope.getModule();
104+
constant = publicOnly ?
105+
module.getConstantFromNoConstMissing(name, false) :
106+
module.getConstantNoConstMissing(context, name);
107+
>>>>>>> Stashed changes
95108
}
96109

97110
// Call const_missing or cache

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,26 @@ 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;
29+
<<<<<<< Updated upstream
3030
IRubyObject constant = (staticScope == null) ? object.getConstant(id) : staticScope.getConstantInner(id);
31+
=======
32+
IRubyObject constant = staticScope.getScopedConstant(context, id);
33+
>>>>>>> Stashed changes
3134

3235
// Inheritance lookup
3336
RubyModule module = null;
3437
if (constant == null) {
38+
<<<<<<< Updated upstream
3539
// SSS FIXME: Is this null check case correct?
3640
module = staticScope == null ? object : staticScope.getModule();
3741
constant = publicOnly ? module.getConstantFromNoConstMissing(id, false) : module.getConstantNoConstMissing(id);
42+
=======
43+
module = staticScope.getModule();
44+
constant = publicOnly ?
45+
module.getConstantFromNoConstMissing(id, false) :
46+
module.getConstantNoConstMissing(context, id);
47+
>>>>>>> Stashed changes
3848
}
3949

4050
// Call const_missing or cache

0 commit comments

Comments
 (0)