Project

General

Profile

Actions

Bug #1209

closed

duplicate when clauses raise strange exception

Added by mame (Yusuke Endoh) over 16 years ago. Updated about 14 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
Backport:
[ruby-dev:38079]

Description

=begin
遠藤です。

文字列の when 節を重複させると、怪しい例外があがります。

$ ruby19 -e 'case "x"; when "x"; when "x"; end'
ruby19: method `eql?' called on terminated object (0x826e0f0)
(NotImplementedError)

[ruby-dev:37959] の関係で、文字列リテラルが不可視になった影響のようです。
不可視をやめてしまえばとりあえず解決しますが、そうすると ObjectSpace で
when 節の文字列を書き換えられてしまうようになります。
どうしたものでしょう。

以下は when 節の文字列だけ不可視をはずすパッチです。

Index: compile.c

--- compile.c (revision 22632)
+++ compile.c (working copy)
@@ -2271,7 +2271,7 @@
break;
}
case NODE_STR:

  • return node->nd_lit;
  • return rb_str_resurrect(node->nd_lit);
    }
    return Qfalse;
    }

--
Yusuke ENDOH
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0