Skip to content

Commit

Permalink
Properly adapt IR argsDesc to "parameterList" format.
Browse files Browse the repository at this point in the history
Fixes #2920
  • Loading branch information
headius committed May 8, 2015
1 parent 85d246a commit d2ea69e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
5 changes: 3 additions & 2 deletions core/src/main/java/org/jruby/RubyMethod.java
Expand Up @@ -206,13 +206,14 @@ public int getLine() {
};

BlockBody body;
String[] parameterList = JRubyLibrary.MethodExtensions.methodParameters(runtime, method);
if (method instanceof IRMethodArgs) {
Signature signature = ((IRMethodArgs) method).getSignature();
body = CompiledBlockLight19.newCompiledBlockLight(signature,
runtime.getStaticScopeFactory().getDummyScope(), callback, false, -1, JRubyLibrary.MethodExtensions.methodParameters(runtime, method));
runtime.getStaticScopeFactory().getDummyScope(), callback, false, -1, parameterList);
} else {
body = CompiledBlockLight19.newCompiledBlockLight(method.getArity(),
runtime.getStaticScopeFactory().getDummyScope(), callback, false, -1, JRubyLibrary.MethodExtensions.methodParameters(runtime, method));
runtime.getStaticScopeFactory().getDummyScope(), callback, false, -1, parameterList);
}
Block b = new Block(body, context.currentBinding(receiver, Visibility.PUBLIC));

Expand Down
13 changes: 1 addition & 12 deletions core/src/main/java/org/jruby/ext/jruby/JRubyLibrary.java
Expand Up @@ -189,18 +189,7 @@ public static String[] methodParameters(Ruby runtime, DynamicMethod method) {
if (method instanceof MethodArgs2) {
return ((MethodArgs2) method).getParameterList();
} else if (method instanceof IRMethodArgs) {
String[] argsDesc = ((IRMethodArgs) method).getParameterList();

for (int i = 0; i < argsDesc.length; i++) {
String argType = argsDesc[i];
i++;
String argName = argsDesc[i];
if (argName.isEmpty()) {
argsArray.add(argType);
} else {
argsArray.add(argType + argName);
}
}
return Helpers.irMethodArgsToParameters(((IRMethodArgs) method).getParameterList());
} else {
if (method.getArity() == Arity.OPTIONAL) {
argsArray.add("r");
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/runtime/Helpers.java
Expand Up @@ -2668,6 +2668,8 @@ public static String[] irMethodArgsToParameters(String[] argDesc) {
tmp[i] = "K" + name;
} else if (type.equals("keyrest")) {
tmp[i] = "e" + name;
} else if (type.equals("req")) {
tmp[i] = "q" + name;
} else {
tmp[i] = type.charAt(0) + name;
}
Expand Down

0 comments on commit d2ea69e

Please sign in to comment.