summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-03-16 09:25:45 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-03-16 09:25:45 +0000
commitfeda16cbd48c1c60b304218e41985cd378382190 (patch)
treeb27fc8161f4f1f52fd4c0b453861b60c452d259b
parent4007644d8378c85c0e90ddd9d29e90e3713546af (diff)
* eval.c (rb_call0): reorganize "return" event post.
* eval.c (return_jump): no need to post "return" event here. * object.c (str_to_id): raise ArgumentError for NUL containing strings. * parse.y (primary): wrong var node was set for NODE_LAMBDA. [ruby-core:04555] * re.c (make_regexp): need to free internal regexp structure when compilation fails. [ruby-talk:133228] * parse.y (bv_decl): remove initialize rule from block local variable declaration. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog26
-rw-r--r--eval.c33
-rw-r--r--node.h1
-rw-r--r--object.c3
-rw-r--r--parse.y13
-rw-r--r--re.c8
6 files changed, 51 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index b4602d8b6b..a4e351fd27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Mar 16 18:08:32 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call0): reorganize "return" event post.
+
+ * eval.c (return_jump): no need to post "return" event here.
+
Tue Mar 15 23:49:19 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/iconv/iconv.c (Init_iconv): InvalidEncoding also should include
@@ -24,6 +30,11 @@ Mon Mar 14 12:21:03 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk/timer.rb (TkRTTimer): forgot to reset the callback
time. So, 'continue' do all callbacks between 'stop' and 'continue'.
+Mon Mar 14 08:14:56 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (str_to_id): raise ArgumentError for NUL containing
+ strings.
+
Mon Mar 14 00:13:49 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk/timer.rb (TkRTTimer): correct calculation of offset
@@ -64,6 +75,11 @@ Sun Mar 13 02:09:03 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/ossl_ssl.c (ossl_tmp_dh_callback): ditto.
(ossl_call_tmp_dh_callback): ditto
+Fri Mar 11 03:24:59 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (primary): wrong var node was set for NODE_LAMBDA.
+ [ruby-core:04555]
+
Thu Mar 10 19:10:29 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/tcltklib.c (lib_eventloop_ensure): mis-delete a timer handler
@@ -83,6 +99,16 @@ Thu Mar 10 19:10:29 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/sample/tktextio.rb: add test part of "seek by text index
modifiers"
+Thu Mar 10 08:10:11 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (make_regexp): need to free internal regexp structure when
+ compilation fails. [ruby-talk:133228]
+
+Thu Mar 10 01:08:20 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (bv_decl): remove initialize rule from block local
+ variable declaration.
+
Wed Mar 9 23:55:34 2005 Tanaka Akira <akr@m17n.org>
* lib/pp.rb (PP::PPMethods#guard_inspect_key): support
diff --git a/eval.c b/eval.c
index e2b04b7093..c9ea17b905 100644
--- a/eval.c
+++ b/eval.c
@@ -4591,10 +4591,6 @@ return_jump(retval)
{
tt->dst = (VALUE)tt->frame->uniq;
tt->retval = retval;
- if (trace_func) {
- struct FRAME *f = tt->frame;
- call_trace_func("return", f->node, f->self, f->this_func, f->this_class);
- }
JUMP_TAG(TAG_RETURN);
}
if (tt->tag == PROT_THREAD) {
@@ -5548,6 +5544,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
int itr;
static int tick;
volatile VALUE args;
+ volatile int trace_status = 0; /* 0:none 1:cfunc 2:rfunc */
TMP_PROTECT;
switch (ruby_iter->iter) {
@@ -5589,21 +5586,10 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
len, rb_class2name(klass), rb_id2name(id));
}
if (trace_func) {
- int state;
-
call_trace_func("c-call", ruby_current_node, recv, id, klass);
- PUSH_TAG(PROT_FUNC);
- if ((state = EXEC_TAG()) == 0) {
- result = call_cfunc(body->nd_cfnc, recv, len, argc, argv);
- }
- POP_TAG();
- ruby_current_node = ruby_frame->node;
- call_trace_func("c-return", ruby_current_node, recv, id, klass);
- if (state) JUMP_TAG(state);
- }
- else {
- result = call_cfunc(body->nd_cfnc, recv, len, argc, argv);
+ trace_status = 1; /* cfunc */
}
+ result = call_cfunc(body->nd_cfnc, recv, len, argc, argv);
}
break;
@@ -5730,11 +5716,9 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
if (trace_func) {
call_trace_func("call", b2, recv, id, klass);
+ trace_status = 2; /* rfunc */
}
result = rb_eval(recv, body);
- if (trace_func) {
- call_trace_func("return", body, recv, id, klass);
- }
}
else if (state == TAG_RETURN && TAG_DST()) {
result = prot_tag->retval;
@@ -5745,6 +5729,15 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
POP_CLASS();
POP_SCOPE();
ruby_cref = saved_cref;
+ switch (trace_status) {
+ case 0: break; /* none */
+ case 1: /* cfunc */
+ call_trace_func("c-return", body, recv, id, klass);
+ break;
+ case 2: /* rfunc */
+ call_trace_func("return", body, recv, id, klass);
+ break;
+ }
switch (state) {
case 0:
break;
diff --git a/node.h b/node.h
index 6a0bb09e12..6cd8b0e415 100644
--- a/node.h
+++ b/node.h
@@ -341,7 +341,6 @@ typedef struct RNode {
#define NEW_BMETHOD(b) NEW_NODE(NODE_BMETHOD,0,0,b)
#define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
#define NEW_PRELUDE(p,b) NEW_NODE(NODE_PRELUDE,p,b,0)
-#define NEW_LAMBDA(v,b) NEW_NODE(NODE_LAMBDA,v,b,0)
#define NOEX_PUBLIC 0
#define NOEX_NOSUPER 1
diff --git a/object.c b/object.c
index b95b097b6a..1a81fd7d80 100644
--- a/object.c
+++ b/object.c
@@ -1567,6 +1567,9 @@ str_to_id(str)
if (!RSTRING(str)->ptr || RSTRING(str)->len == 0) {
rb_raise(rb_eArgError, "empty symbol string");
}
+ if (RSTRING(str)->len != strlen(RSTRING(str)->ptr)) {
+ rb_raise(rb_eArgError, "Symbols should not contain NUL (\\0)");
+ }
return rb_intern(RSTRING(str)->ptr);
}
diff --git a/parse.y b/parse.y
index 5c22378672..e91be7147b 100644
--- a/parse.y
+++ b/parse.y
@@ -2538,7 +2538,10 @@ primary : literal
'}'
{
/*%%%*/
- $$ = NEW_LAMBDA($3, dyna_init($5, $<vars>4));
+ $3->nd_body = block_append($3->nd_body,
+ dyna_init($5, $<vars>4));
+ $$ = $3;
+ nd_set_type($3, NODE_LAMBDA);
nd_set_line($$, $<num>1);
dyna_pop($<vars>2);
/*%
@@ -3176,14 +3179,6 @@ bv_decl : tIDENTIFIER
$$ = FIXME;
%*/
}
- | tIDENTIFIER '=' primary
- {
- /*%%%*/
- $$ = new_bv($1, $3);
- /*%
- $$ = FIXME;
- %*/
- }
;
do_block : kDO_BLOCK
diff --git a/re.c b/re.c
index 937eac66b4..10fe8c68d3 100644
--- a/re.c
+++ b/re.c
@@ -657,6 +657,7 @@ make_regexp(s, len, flags, ce)
r = onig_compile(rp, (UChar* )s, (UChar* )(s + len), &einfo);
if (r != 0) {
+ onig_free(rp);
(void )onig_error_code_to_str((UChar* )err, r, &einfo);
rb_reg_raise(s, len, err, 0, ce);
}
@@ -1893,11 +1894,12 @@ rb_reg_quote(str)
/*
* call-seq:
- * Regexp.escape(str) => new_str
- * Regexp.quote(str) => new_str
+ * Regexp.escape(str) => a_str
+ * Regexp.quote(str) => a_str
*
* Escapes any characters that would have special meaning in a regular
- * expression. For any string,
+ * expression. Returns a new escaped string, or self if no characters are
+ * escaped. For any string,
* <code>Regexp.escape(<i>str</i>)=~<i>str</i></code> will be true.
*
* Regexp.escape('\\*?{}.') #=> \\\\\*\?\{\}\.