Skip to content

Commit

Permalink
Change enum rb_parser_ary_data_type default value to 1 for easy debug
Browse files Browse the repository at this point in the history
We face `[BUG] unexpected rb_parser_ary_data_type (0) for script lines`
on master branch recently.
This commit changes `enum rb_parser_ary_data_type` to start with `1`
and `0` to be invalid then it makes clear `rb_parser_ary_data_type (0)`
is not intentional.
  • Loading branch information
yui-knk committed Jun 25, 2024
1 parent a47c152 commit 4fb7e1b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -2512,6 +2512,7 @@ parser_ary_new_capa(rb_parser_t *p, long len)
rb_bug("negative array size (or size too big): %ld", len);
}
rb_parser_ary_t *ary = xcalloc(1, sizeof(rb_parser_ary_t));
ary->data_type = 0;
ary->len = 0;
ary->capa = len;
if (0 < len) {
Expand Down
2 changes: 1 addition & 1 deletion rubyparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ typedef struct rb_parser_ast_token {
typedef void* rb_parser_ary_data;

enum rb_parser_ary_data_type {
PARSER_ARY_DATA_AST_TOKEN,
PARSER_ARY_DATA_AST_TOKEN = 1,
PARSER_ARY_DATA_SCRIPT_LINE
};

Expand Down

0 comments on commit 4fb7e1b

Please sign in to comment.