From 4cfc1aa9591714b0d9ccc9a8f5ce4461a82db899 Mon Sep 17 00:00:00 2001
From: yui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Sat, 9 Dec 2017 13:13:58 +0000
Subject: [PATCH] parse.y: Fix locations of NODE_ARRAY in NODE_ATTRASGN
 (nd_args)

* parse.y (arg_append_gen): Fix to only include a range of
  node2 if new list is generated.

  e.g. The locations of the NODE_ARRAY is fixed:

  ```
  x.default = 5
  ```

  * Before

  ```
  NODE_ARRAY (line: 1, code_range: (1,0)-(1,13))
  ```

  * After

  ```
  NODE_ARRAY (line: 1, code_range: (1,12)-(1,13))
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
---
 parse.y | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parse.y b/parse.y
index 0ebc24109d..b7607663fe 100644
--- a/parse.y
+++ b/parse.y
@@ -10118,7 +10118,7 @@ arg_append_gen(struct parser_params *parser, NODE *node1, NODE *node2, const YYL
 {
     NODE *argspush;
 
-    if (!node1) return new_list(node2, location);
+    if (!node1) return new_list(node2, &node2->nd_loc);
     switch (nd_type(node1))  {
       case NODE_ARRAY:
 	return list_append(node1, node2, location);