[ruby/prism] Short-circuit if possible for start line and unused warning
https://github.com/ruby/prism/commit/2745c81d31
This commit is contained in:
parent
7a198af7cd
commit
ebbb093094
@ -961,8 +961,7 @@ pm_locals_order(PRISM_ATTRIBUTE_UNUSED pm_parser_t *parser, pm_locals_t *locals,
|
|||||||
if (local->name != PM_CONSTANT_ID_UNSET) {
|
if (local->name != PM_CONSTANT_ID_UNSET) {
|
||||||
pm_constant_id_list_insert(list, (size_t) local->index, local->name);
|
pm_constant_id_list_insert(list, (size_t) local->index, local->name);
|
||||||
|
|
||||||
if (warn_unused && local->reads == 0) {
|
if (warn_unused && local->reads == 0 && ((parser->start_line >= 0) || (pm_newline_list_line(&parser->newline_list, local->location.start, parser->start_line) >= 0))) {
|
||||||
if (pm_newline_list_line(&parser->newline_list, local->location.start, parser->start_line) >= 0) {
|
|
||||||
pm_constant_t *constant = pm_constant_pool_id_to_constant(&parser->constant_pool, local->name);
|
pm_constant_t *constant = pm_constant_pool_id_to_constant(&parser->constant_pool, local->name);
|
||||||
|
|
||||||
if (constant->length >= 1 && *constant->start != '_') {
|
if (constant->length >= 1 && *constant->start != '_') {
|
||||||
@ -979,7 +978,6 @@ pm_locals_order(PRISM_ATTRIBUTE_UNUSED pm_parser_t *parser, pm_locals_t *locals,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Node-related functions */
|
/* Node-related functions */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user