diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2017-05-18 15:59:38 -0700 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-10-09 23:46:50 +0900 |
commit | bb71a128eb6e901d3d7deb895971a6706eb7110d (patch) | |
tree | 5a92d96b884a39c9101286bd59e97d8df6a71245 /parse.y | |
parent | 29e6782f5dbf127dc20156938af374eea9e2d74e (diff) | |
download | bundler-bb71a128eb6e901d3d7deb895971a6706eb7110d.tar.gz |
Prefer st_is_member over st_lookup with 0
The st_is_member DEFINE has simpler semantics, for more readable code.
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -821,7 +821,7 @@ new_unique_key_hash(struct parser_params *p, VALUE ary, const YYLTYPE *loc) goto error; } if (!RB_TYPE_P(key, T_STRING)) goto error; - if (st_lookup(tbl, (st_data_t)RSTRING_PTR(key), 0)) goto error; + if (st_is_member(tbl, (st_data_t)RSTRING_PTR(key))) goto error; st_insert(tbl, (st_data_t)RSTRING_PTR(key), (st_data_t)ary); } st_free_table(tbl); @@ -11463,7 +11463,7 @@ error_duplicate_keys(struct parser_params *p, NODE *hash) if (nd_type(head) != NODE_LIT) { yyerror1(&head->nd_loc, "key must be symbol literal"); } - if (st_lookup(literal_keys, (key = head->nd_lit), 0)) { + if (st_is_member(literal_keys, (key = head->nd_lit))) { yyerror1(&head->nd_loc, "duplicated key name"); } else { |