diff options
author | davidflanagan <davidflanagan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-07 22:17:58 +0000 |
---|---|---|
committer | davidflanagan <davidflanagan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-07 22:17:58 +0000 |
commit | 89397d2f6e158877ea72c3ceaeda59efad2c32e0 (patch) | |
tree | 82c4460d1e3a2fbeb5d461a52752c760668fb7c5 | |
parent | f6fb4b3e8ecede29d25e4b5577174ed6f98d88c8 (diff) | |
download | ruby-89397d2f6e158877ea72c3ceaeda59efad2c32e0.tar.gz |
* parse.y (rb_intern3): commented out broken code that prevented
correct interning of multi-byte symbols. Without this patch
:x==:x is false when x is a multi-byte character.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | parse.y | 16 |
2 files changed, 21 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Thu Nov 8 07:14:37 UTC 2007 David Flanagan <davidflanagan@ruby-lang.org> + * parse.y (rb_intern3): commented out broken code that prevented + correct interning of multi-byte symbols. Without this patch + :x==:x is false when x is a multi-byte character. + Thu Nov 8 07:04:31 UTC 2007 David Flanagan <davidflanagan@ruby-lang.org> * string.c (tr_setup_table, tr_trans): fix test failures in test/ruby/test_string.rb @@ -8661,6 +8661,21 @@ 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 (!mb) { for (; m <= name + len; ++m) { @@ -8670,6 +8685,7 @@ rb_intern3(const char *name, long len, rb_encoding *enc) enc = rb_enc_from_index(0); mbstr:; } + */ new_id: id |= ++global_symbols.last_id << ID_SCOPE_SHIFT; id_register: |