ruby-changes:12162
From: nobu <ko1@a...>
Date: Wed, 24 Jun 2009 15:02:51 +0900 (JST)
Subject: [ruby-changes:12162] Ruby:r23837 (trunk): * parse.y (parser_set_encode): show the erred file name instead of
nobu 2009-06-24 15:02:33 +0900 (Wed, 24 Jun 2009) New Revision: 23837 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23837 Log: * parse.y (parser_set_encode): show the erred file name instead of the file that requires it. [ruby-core:24006] Modified files: trunk/ChangeLog trunk/parse.y Index: ChangeLog =================================================================== --- ChangeLog (revision 23836) +++ ChangeLog (revision 23837) @@ -1,3 +1,8 @@ +Wed Jun 24 15:02:29 2009 Nobuyoshi Nakada <nobu@r...> + + * parse.y (parser_set_encode): show the erred file name instead of + the file that requires it. [ruby-core:24006] + Wed Jun 24 11:41:20 2009 Akinori MUSHA <knu@i...> * misc/ruby-style.el: It is too late to set c-file-style in Index: parse.y =================================================================== --- parse.y (revision 23836) +++ parse.y (revision 23837) @@ -6066,13 +6066,23 @@ { int idx = rb_enc_find_index(name); rb_encoding *enc; + VALUE excargs[3]; if (idx < 0) { - rb_raise(rb_eArgError, "unknown encoding name: %s", name); + VALUE rb_make_backtrace(void); + VALUE rb_make_exception(int, VALUE*); + + excargs[1] = rb_sprintf("unknown encoding name: %s", name); + error: + excargs[0] = rb_eArgError; + excargs[2] = rb_make_backtrace(); + rb_ary_unshift(excargs[2], rb_sprintf("%s:%d", ruby_sourcefile, ruby_sourceline)); + rb_exc_raise(rb_make_exception(3, excargs)); } enc = rb_enc_from_index(idx); if (!rb_enc_asciicompat(enc)) { - rb_raise(rb_eArgError, "%s is not ASCII compatible", rb_enc_name(enc)); + excargs[1] = rb_sprintf("%s is not ASCII compatible", rb_enc_name(enc)); + goto error; } parser->enc = enc; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/