Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2ae066ad62ac
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 61063db5b7f6
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Nov 28, 2016

  1. Copy the full SHA
    3f16716 View commit details
  2. Copy the full SHA
    61063db View commit details
Showing with 9 additions and 20 deletions.
  1. +5 −9 core/src/main/java/org/jruby/ir/IRBuilder.java
  2. +4 −11 core/src/main/java/org/jruby/parser/ParserSupport.java
14 changes: 5 additions & 9 deletions core/src/main/java/org/jruby/ir/IRBuilder.java
Original file line number Diff line number Diff line change
@@ -1979,23 +1979,19 @@ protected LocalVariable getArgVariable(String name, int depth) {
return scope instanceof IRFor ? getLocalVariable(name, depth) : getNewLocalVariable(name, 0);
}

private void addArgReceiveInstr(Variable v, int argIndex, boolean post, int numPreReqd, int numPostRead) {
if (post) {
addInstr(new ReceivePostReqdArgInstr(v, argIndex, numPreReqd, numPostRead));
} else {
addInstr(new ReceivePreReqdArgInstr(v, argIndex));
}
}
private void addArgReceiveInstr(Variable v, int argIndex, boolean post, int numPreReqd, int numPostRead) rece

/* '_' can be seen as a variable only by its first assignment as a local variable. For any additional
* '_' we create temporary variables in the case the scope has a zsuper in it. If so, then the zsuper
* call will slurp those temps up as it's parameters so it can properly set up the call.
*/
private Variable argumentResult(String name) {
if (name.equals("_") && underscoreVariableSeen) {
boolean isUnderscore = name.equals("_");

if (isUnderscore && underscoreVariableSeen) {
return createTemporaryVariable();
} else {
underscoreVariableSeen = true;
if (isUnderscore) underscoreVariableSeen = true;
return getNewLocalVariable(name, 0);
}
}
15 changes: 4 additions & 11 deletions core/src/main/java/org/jruby/parser/ParserSupport.java
Original file line number Diff line number Diff line change
@@ -1216,18 +1216,11 @@ public String shadowing_lvar(String name) {
if (name == "_") return name;

StaticScope current = getCurrentScope();
if (current.isBlockScope()) {
if (current.exists(name) >= 0) yyerror("duplicated argument name");
if (current.exists(name) >= 0) yyerror("duplicated argument name");

if (warnings.isVerbose() && current.isDefined(name) >= 0 &&
Options.PARSER_WARN_LOCAL_SHADOWING.load() &&
!ParserSupport.skipTruffleRubiniusWarnings(lexer)) {

warnings.warning(ID.STATEMENT_NOT_REACHED, lexer.getPosition(),
"shadowing outer local variable - " + name);
}
} else if (current.exists(name) >= 0) {
yyerror("duplicated argument name");
if (current.isBlockScope() && warnings.isVerbose() && current.isDefined(name) >= 0 &&
Options.PARSER_WARN_LOCAL_SHADOWING.load() && !ParserSupport.skipTruffleRubiniusWarnings(lexer)) {
warnings.warning(ID.STATEMENT_NOT_REACHED, lexer.getPosition(), "shadowing outer local variable - " + name);
}

return name;