Skip to content

Commit 1ecc773

Browse files
committed
Fix arity of rb_define_method()-defined methods
1 parent ff38223 commit 1ecc773

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

spec/tags/optional/capi/module_tags.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/main/java/org/truffleruby/core/module/ModuleNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ private RubySymbol defineMethod(RubyModule module, String name, RubyProc proc,
13341334
MaterializedFrame callerFrame) {
13351335
final RootCallTarget callTargetForLambda = proc.callTargets.getCallTargetForLambda();
13361336
final RubyLambdaRootNode rootNode = RubyLambdaRootNode.of(callTargetForLambda);
1337-
final SharedMethodInfo info = proc.getSharedMethodInfo().forDefineMethod(module, name);
1337+
final SharedMethodInfo info = proc.getSharedMethodInfo().forDefineMethod(module, name, proc);
13381338
final RubyNode body = rootNode.copyBody();
13391339
final RubyNode newBody = new CallMethodWithLambdaBody(isSingleContext() ? proc : null,
13401340
callTargetForLambda, body);

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.truffleruby.RubyLanguage;
1313
import org.truffleruby.core.klass.RubyClass;
1414
import org.truffleruby.core.module.RubyModule;
15+
import org.truffleruby.core.proc.RubyProc;
1516
import org.truffleruby.language.LexicalScope;
1617
import org.truffleruby.language.RubyDynamicObject;
1718
import org.truffleruby.language.RubyGuards;
@@ -60,16 +61,16 @@ public SharedMethodInfo(
6061
this.argumentDescriptors = argumentDescriptors;
6162
}
6263

63-
public SharedMethodInfo forDefineMethod(RubyModule declaringModule, String methodName) {
64+
public SharedMethodInfo forDefineMethod(RubyModule declaringModule, String methodName, RubyProc proc) {
6465
return new SharedMethodInfo(
6566
sourceSection,
6667
staticLexicalScope,
67-
arity,
68+
proc.arity,
6869
methodName,
6970
0, // no longer a block
7071
moduleAndMethodName(declaringModule, methodName),
7172
null,
72-
argumentDescriptors);
73+
proc.argumentDescriptors);
7374
}
7475

7576
public SharedMethodInfo convertMethodMissingToMethod(RubyModule declaringModule, String methodName) {

0 commit comments

Comments
 (0)