Skip to content

Commit b1dbca4

Browse files
committed
Add public functions to modify Arity
1 parent 5a015e2 commit b1dbca4

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/main/java/org/truffleruby/core/proc/RubyProc.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,22 @@ public RubyProc(
7474
this.declarationContext = declarationContext;
7575
}
7676

77+
public RubyProc withSharedMethodInfo(SharedMethodInfo newSharedMethodInfo, RubyClass newRubyClass, Shape newShape) {
78+
return new RubyProc(
79+
newRubyClass,
80+
newShape,
81+
type,
82+
newSharedMethodInfo,
83+
callTargets,
84+
callTarget,
85+
declarationFrame,
86+
declarationVariables,
87+
method,
88+
block,
89+
frameOnStackMarker,
90+
declarationContext);
91+
}
92+
7793
@Override
7894
public void getAdjacentObjects(Set<Object> reachable) {
7995
ObjectGraph.getObjectsInFrame(declarationFrame, reachable);

src/main/java/org/truffleruby/language/methods/SharedMethodInfo.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ public SharedMethodInfo convertMethodMissingToMethod(RubyModule declaringModule,
9191
newArgs);
9292
}
9393

94+
public SharedMethodInfo withArity(Arity newArity) {
95+
return new SharedMethodInfo(
96+
sourceSection,
97+
lexicalScope,
98+
newArity,
99+
backtraceName,
100+
blockDepth,
101+
parseName,
102+
notes,
103+
argumentDescriptors);
104+
}
105+
94106
public SourceSection getSourceSection() {
95107
return sourceSection;
96108
}

0 commit comments

Comments
 (0)