Skip to content

Commit 8b8d66e

Browse files
committed
Do not warn for locals that start with _
1 parent 8bbd3fe commit 8b8d66e

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/prism.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,14 +1021,16 @@ pm_locals_order(PRISM_ATTRIBUTE_UNUSED pm_parser_t *parser, pm_locals_t *locals,
10211021
if (warn_unused && local->reads == 0) {
10221022
pm_constant_t *constant = pm_constant_pool_id_to_constant(&parser->constant_pool, local->name);
10231023

1024-
PM_PARSER_WARN_FORMAT(
1025-
parser,
1026-
local->location.start,
1027-
local->location.end,
1028-
PM_WARN_UNUSED_LOCAL_VARIABLE,
1029-
(int) constant->length,
1030-
(const char *) constant->start
1031-
);
1024+
if (constant->length >= 1 && *constant->start != '_') {
1025+
PM_PARSER_WARN_FORMAT(
1026+
parser,
1027+
local->location.start,
1028+
local->location.end,
1029+
PM_WARN_UNUSED_LOCAL_VARIABLE,
1030+
(int) constant->length,
1031+
(const char *) constant->start
1032+
);
1033+
}
10321034
}
10331035
}
10341036
}

0 commit comments

Comments
 (0)