Skip to content

Commit

Permalink
Showing 2 changed files with 1 addition and 22 deletions.
16 changes: 1 addition & 15 deletions core/src/main/java/org/jruby/parser/ParserSupport.java
Original file line number Diff line number Diff line change
@@ -1201,22 +1201,8 @@ public Node new_bv(String identifier) {
return arg_var(identifier);
}

// 1.9
public ArgumentNode arg_var(String name) {
StaticScope current = getCurrentScope();

// Multiple _ arguments are allowed. To not screw with tons of arity
// issues in our runtime we will allocate unnamed bogus vars so things
// still work. MRI does not use name as intern'd value so they don't
// have this issue.
if (name == "_") {
int count = 0;
while (current.exists(name) >= 0) {
name = ("_$" + count++).intern();
}
}

return new ArgumentNode(lexer.getPosition(), name, current.addVariableThisScope(name));
return new ArgumentNode(lexer.getPosition(), name, getCurrentScope().addVariableThisScope(name));
}

public String formal_argument(String identifier) {
7 changes: 0 additions & 7 deletions core/src/main/java/org/jruby/parser/StaticScope.java
Original file line number Diff line number Diff line change
@@ -240,13 +240,6 @@ private static boolean namesAreInterned(String[] names) {
* @return index of variable
*/
public int addVariableThisScope(String name) {
// Ignore duplicate "_" args in blocks
// (duplicate _ args are named "_$0")
// Dont allocate slots for them.
if (name.equals("_$0")) {
return -1;
}

int slot = exists(name);

if (slot >= 0) return slot;

0 comments on commit a6a0479

Please sign in to comment.