Exemple #1
0
  public IRubyObject shadowing_lvar(IRubyObject identifier) {
    String name = lexer.getIdent();

    if (name == "_") return identifier;

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

      if (lexer.isVerbose() && current.isDefined(name) >= 0) {
        lexer.warning("shadowing outer local variable - " + name);
      }
    } else if (current.exists(name) >= 0) {
      yyerror("duplicated argument name");
    }

    return identifier;
  }