summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-30 18:30:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-30 18:30:49 +0000
commit54062fed1199263720ec1ac20226f3d7ab18db6c (patch)
treeb013fa07c7f523671a32bdfe997f50de87b13f76 /parse.y
parentd731c29b0662e891192a317506bdbccc3c0819a9 (diff)
* parse.y (newline_node): set line from outermost node before removing
NODE_BEGIN. [ruby-dev:32406] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@14059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y13
1 files changed, 8 insertions, 5 deletions
diff --git a/parse.y b/parse.y
index 9b8cf15..414c775 100644
--- a/parse.y
+++ b/parse.y
@@ -398,11 +398,11 @@ compstmt : stmts opt_terms
stmts : none
| stmt
{
- $$ = newline_node(remove_begin($1));
+ $$ = newline_node($1);
}
| stmts terms stmt
{
- $$ = block_append($1, newline_node(remove_begin($3)));
+ $$ = block_append($1, newline_node($3));
}
| error stmt
{
@@ -4549,10 +4549,13 @@ newline_node(node)
{
NODE *nl = 0;
if (node) {
+ int line;
if (nd_type(node) == NODE_NEWLINE) return node;
- nl = NEW_NEWLINE(node);
- fixpos(nl, node);
- nl->nd_nth = nd_line(node);
+ line = nd_line(node);
+ node = remove_begin(node);
+ nl = NEW_NEWLINE(node);
+ nd_set_line(nl, line);
+ nl->nd_nth = line;
}
return nl;
}