summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-01-11 07:55:27 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-01-11 07:55:27 +0000
commita9c4c9041bd8ee877e062f93496a03d3c767d6e4 (patch)
treebe7e553d1463426a284ad8c0588e9e717cfcf7b5 /eval.c
parentfb1369446bbe1f53f4144ba12f76b89f1a542835 (diff)
1.2.1 stable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/eval.c b/eval.c
index f72ab0b0e4..001f07d9fc 100644
--- a/eval.c
+++ b/eval.c
@@ -1262,7 +1262,7 @@ mod_alias_method(mod, newname, oldname)
# define TMP_PROTECT NODE * volatile __protect_tmp=0
# define TMP_ALLOC(n) \
(__protect_tmp = node_newnode(NODE_ALLOCA, \
- ALLOCA_N(VALUE,n),__protect_tmp,n),\
+ ALLOC_N(VALUE,n),__protect_tmp,n),\
(void*)__protect_tmp->nd_head)
#else
# define TMP_PROTECT typedef int foobazzz
@@ -2316,11 +2316,12 @@ rb_eval(self, node)
str = str_new3(node->nd_lit);
while (list) {
- if (nd_type(list->nd_head) == NODE_STR) {
- str2 = list->nd_head->nd_lit;
- }
- else {
- if (nd_type(list->nd_head) == NODE_EVSTR) {
+ if (list->nd_head) {
+ switch (nd_type(list->nd_head)) {
+ case NODE_STR:
+ str2 = list->nd_head->nd_lit;
+ break;
+ case NODE_EVSTR:
rb_in_eval++;
list->nd_head = compile(list->nd_head->nd_lit,0);
eval_tree = 0;
@@ -2328,11 +2329,12 @@ rb_eval(self, node)
if (nerrs > 0) {
compile_error("string expansion");
}
+ /* fall through */
+ default:
+ str2 = rb_eval(self, list->nd_head);
+ str2 = obj_as_string(str2);
+ break;
}
- str2 = rb_eval(self, list->nd_head);
- str2 = obj_as_string(str2);
- }
- if (str2) {
str_cat(str, RSTRING(str2)->ptr, RSTRING(str2)->len);
if (str_tainted(str2)) str_taint(str);
}