summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--parse.y22
2 files changed, 27 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9994504006..3d3f6a8eae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Aug 10 09:12:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (rb_id_attrset): check if the argument is valid type as an
+ attribute.
+
Sat Aug 10 05:44:08 2013 Zachary Scott <e@zzak.io>
* lib/rss/trackback.rb: [DOC] Hide RSS::Trackback from rdoc
diff --git a/parse.y b/parse.y
index f392be7bfa..8a31a74158 100644
--- a/parse.y
+++ b/parse.y
@@ -8766,9 +8766,31 @@ block_dup_check_gen(struct parser_params *parser, NODE *node1, NODE *node2)
}
}
+static const char id_type_names[][9] = {
+ "LOCAL",
+ "INSTANCE",
+ "", /* INSTANCE2 */
+ "GLOBAL",
+ "ATTRSET",
+ "CONST",
+ "CLASS",
+ "JUNK",
+};
+
ID
rb_id_attrset(ID id)
{
+ if (!is_notop_id(id)) {
+ rb_bug("rb_id_attrset: operator ID - %"PRIdVALUE, (VALUE)id);
+ }
+ else {
+ int scope = (int)(id & ID_SCOPE_MASK);
+ if (scope != ID_LOCAL && scope != ID_CONST) {
+ rb_bug("rb_id_attrset: %s ID - %"PRIdVALUE, id_type_names[scope],
+ (VALUE)id);
+
+ }
+ }
id &= ~ID_SCOPE_MASK;
id |= ID_ATTRSET;
return id;