aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authorBen Woosley <ben.woosley@gmail.com>2017-05-18 15:59:38 -0700
committer卜部昌平 <shyouhei@ruby-lang.org>2019-10-09 23:46:50 +0900
commitbb71a128eb6e901d3d7deb895971a6706eb7110d (patch)
tree5a92d96b884a39c9101286bd59e97d8df6a71245 /parse.y
parent29e6782f5dbf127dc20156938af374eea9e2d74e (diff)
downloadruby-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.y4
1 files changed, 2 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index 2fd01ddb72..cddeb3c2d5 100644
--- a/parse.y
+++ b/parse.y
@@ -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 {