summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-05 06:25:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-05 06:25:56 +0000
commit0af432ce08b33428b9dc6c5c60ffccee3f60fd77 (patch)
tree50fdf8ea0da4ae76cdcf120c7fb5a35c7f371a14 /parse.y
parente8ffe28214c8908a2fec5d7869d89db9e41eeb4e (diff)
* parse.y (rb_intern3): fix to changing encoding to default, and
uncommented r13835, which is rare but not impossible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y24
1 files changed, 6 insertions, 18 deletions
diff --git a/parse.y b/parse.y
index 43d45c6826..03bbb3bd36 100644
--- a/parse.y
+++ b/parse.y
@@ -8876,31 +8876,19 @@ rb_intern3(const char *name, long len, rb_encoding *enc)
}
}
if (m - name < len) id = ID_JUNK;
- /*
- * davidflanagan: commented out because this just doesn't make sense.
- *
- * If we were called with a non-ascii encoding, then change
- * the encoding to ASCII, unless the symbol had multi-byte characters
- * and there are trailing non-identifier characters that are
- * outside of ASCII. But all multi-byte characters
- * are identifier chars, so there will never be trailing characters
- * so this clause always changes the encoding of the string.
- *
- * The upshot is that the symbol is placed in the hashtable with
- * an ASCII encoding, but is queried (at the top of this function)
- * with its real encoding. So :x == :x is false when x is a
- * multi-byte character.
- *
- if (enc != rb_enc_from_index(0)) {
+ if (enc != rb_default_encoding()) {
+ /*
+ * this clause makes sense only when called from other than
+ * rb_intern_str() taking care of code-range.
+ */
if (!mb) {
for (; m <= name + len; ++m) {
if (!ISASCII(*m)) goto mbstr;
}
+ enc = rb_default_encoding();
}
- enc = rb_enc_from_index(0);
mbstr:;
}
- */
new_id:
id |= ++global_symbols.last_id << ID_SCOPE_SHIFT;
id_register: