Skip to content

Commit

Permalink
No need to set the constants for updateAnonymousChildrenModules()
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed May 30, 2023
1 parent 3f4a07d commit 88935ce
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/main/java/org/truffleruby/core/module/ModuleFields.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,24 @@ public void afterConstructed() {
getName();
}

public RubyConstant getAdoptedByLexicalParent(
RubyContext context,
RubyModule lexicalParent,
String name,
public RubyConstant getAdoptedByLexicalParent(RubyContext context, RubyModule lexicalParent, String name,
Node currentNode) {
return getAdoptedByLexicalParent(context, lexicalParent, name, currentNode, true);
}

private RubyConstant getAdoptedByLexicalParent(RubyContext context, RubyModule lexicalParent, String name,
Node currentNode, boolean setConstant) {
assert name != null;

RubyConstant previous = lexicalParent.fields.setConstantInternal(
context,
currentNode,
name,
rubyModule,
null);
RubyConstant previous = null;
if (setConstant) {
previous = lexicalParent.fields.setConstantInternal(
context,
currentNode,
name,
rubyModule,
null);
}

if (!hasFullName()) {
// Tricky, we need to compare with the Object class, but we only have a Class at hand.
Expand Down Expand Up @@ -208,7 +213,8 @@ public void updateAnonymousChildrenModules(RubyContext context) {
context,
rubyModule,
entry.getKey(),
null);
null,
false);
}
}
}
Expand Down

0 comments on commit 88935ce

Please sign in to comment.