Skip to content

Commit

Permalink
[Truffle] Suppress warnings parsing Rubinius core files.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvdrum committed Jun 18, 2015
1 parent 295ee75 commit 2294de2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/lexer/yacc/RubyLexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ private int hereDocumentIdentifier() throws IOException {
}

private void arg_ambiguous() {
if (warnings.isVerbose() && Options.PARSER_WARN_AMBIGUOUS_ARGUMENTS.load()) {
if (warnings.isVerbose() && Options.PARSER_WARN_AMBIGUOUS_ARGUMENTS.load() && !ParserSupport.skipTruffleRubiniusWarnings(this)) {
warnings.warning(ID.AMBIGUOUS_ARGUMENT, getPosition(), "Ambiguous first argument; make sure.");
}
}
Expand Down Expand Up @@ -2414,7 +2414,7 @@ private int star(boolean spaceSeen) throws IOException {
default:
pushback(c);
if (isSpaceArg(c, spaceSeen)) {
if (warnings.isVerbose() && Options.PARSER_WARN_ARGUMENT_PREFIX.load())
if (warnings.isVerbose() && Options.PARSER_WARN_ARGUMENT_PREFIX.load() && !ParserSupport.skipTruffleRubiniusWarnings(this))
warnings.warning(ID.ARGUMENT_AS_PREFIX, getPosition(), "`*' interpreted as argument prefix");
c = Tokens.tSTAR;
} else if (isBEG()) {
Expand Down
9 changes: 8 additions & 1 deletion core/src/main/java/org/jruby/parser/ParserSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,10 @@ public String shadowing_lvar(String name) {
if (current.isBlockScope()) {
if (current.exists(name) >= 0) yyerror("duplicated argument name");

if (warnings.isVerbose() && current.isDefined(name) >= 0 && Options.PARSER_WARN_LOCAL_SHADOWING.load()) {
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);
}
Expand Down Expand Up @@ -1415,4 +1418,8 @@ public Node new_defined(ISourcePosition position, Node something) {
public String internalId() {
return "";
}

public static boolean skipTruffleRubiniusWarnings(RubyLexer lexer) {
return lexer.tokline.getFile().startsWith("core:/");
}
}

0 comments on commit 2294de2

Please sign in to comment.