1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

parse.y: fix op_assign type

* parse.y (new_attr_op_assign): fix op_assign type, which is
  already an ID since r52284.  [Feature #11537]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-10-28 04:29:41 +00:00
parent edc87841f2
commit 107b0dc8cd
3 changed files with 16 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Wed Oct 28 13:29:39 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (new_attr_op_assign): fix op_assign type, which is
already an ID since r52284. [Feature #11537]
Tue Oct 27 23:14:14 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* defs/id.def: enable anonymous IDs not to expose internal IDs for

View file

@ -521,7 +521,7 @@ static int id_is_var_gen(struct parser_params *parser, ID id);
static VALUE new_op_assign_gen(struct parser_params *parser, VALUE lhs, VALUE op, VALUE rhs);
static VALUE new_attr_op_assign_gen(struct parser_params *parser, VALUE lhs, VALUE type, VALUE attr, VALUE op, VALUE rhs);
#define new_attr_op_assign(lhs, type, attr, op, rhs) new_attr_op_assign_gen(parser, (lhs), ripper_id2sym(type), (attr), (op), (rhs))
#define new_attr_op_assign(lhs, type, attr, op, rhs) new_attr_op_assign_gen(parser, (lhs), (type), (attr), (op), (rhs))
#endif /* !RIPPER */

View file

@ -789,6 +789,16 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
tree = parse('a::X ||= c 1', :on_opassign) {thru_opassign = true}
assert_equal true, thru_opassign
assert_equal "[opassign(const_path_field(vcall(a),X),||=,command(c,[1]))]", tree
thru_opassign = false
tree = parse("self.foo += 1", :on_opassign) {thru_opassign = true}
assert_equal true, thru_opassign
assert_equal "[opassign(field(ref(self),.,foo),+=,1)]", tree
thru_opassign = false
tree = parse("self.?foo += 1", :on_opassign) {thru_opassign = true}
assert_equal true, thru_opassign
assert_equal "[opassign(field(ref(self),.?,foo),+=,1)]", tree
end
def test_opassign_error