mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: reorder conditions
* parse.y (token_info_pop): scan lex buffer only when token info is enabled. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
aad3a8679f
commit
c2310baf9a
1 changed files with 4 additions and 11 deletions
15
parse.y
15
parse.y
|
@ -5335,23 +5335,16 @@ token_info_pop(struct parser_params *parser, const char *token, size_t len)
|
|||
|
||||
if (!ptinfo) return;
|
||||
parser->token_info = ptinfo->next;
|
||||
if (token_info_get_column(parser, t) == ptinfo->column) { /* OK */
|
||||
goto finish;
|
||||
}
|
||||
linenum = ruby_sourceline;
|
||||
if (linenum == ptinfo->linenum) { /* SKIP */
|
||||
goto finish;
|
||||
}
|
||||
if (token_info_has_nonspaces(parser, t) || ptinfo->nonspc) { /* SKIP */
|
||||
goto finish;
|
||||
}
|
||||
if (parser->token_info_enabled) {
|
||||
if (parser->token_info_enabled &&
|
||||
linenum != ptinfo->linenum && !ptinfo->nonspc &&
|
||||
!token_info_has_nonspaces(parser, t) &&
|
||||
token_info_get_column(parser, t) != ptinfo->column) {
|
||||
rb_compile_warn(ruby_sourcefile, linenum,
|
||||
"mismatched indentations at '%s' with '%s' at %d",
|
||||
token, ptinfo->token, ptinfo->linenum);
|
||||
}
|
||||
|
||||
finish:
|
||||
xfree(ptinfo);
|
||||
}
|
||||
#endif /* RIPPER */
|
||||
|
|
Loading…
Reference in a new issue