diff --git a/doc/AST_FORMAT.md b/doc/AST_FORMAT.md index 2b4eba28a..0890401c4 100644 --- a/doc/AST_FORMAT.md +++ b/doc/AST_FORMAT.md @@ -829,7 +829,7 @@ Format: Format: ~~~ -(def_e :foo (args) (int 42)) +(def :foo (args) (int 42)) "def foo() = 42" ~~~ keyword ~~~ name @@ -843,7 +843,7 @@ Format: Format: ~~~ -(defs_e (self) :foo (args) (int 42)) +(defs (self) :foo (args) (int 42)) "def self.foo() = 42" ~~~ keyword ~~~ name diff --git a/lib/parser/ast/processor.rb b/lib/parser/ast/processor.rb index 04d52b673..7617c1acc 100644 --- a/lib/parser/ast/processor.rb +++ b/lib/parser/ast/processor.rb @@ -163,8 +163,6 @@ def on_def(node) ]) end - alias on_def_e on_def - def on_defs(node) definee_node, name, args_node, body_node = *node @@ -174,8 +172,6 @@ def on_defs(node) ]) end - alias on_defs_e on_defs - alias on_undef process_regular_node alias on_alias process_regular_node diff --git a/lib/parser/builders/default.rb b/lib/parser/builders/default.rb index 186121fc4..5aec657f6 100644 --- a/lib/parser/builders/default.rb +++ b/lib/parser/builders/default.rb @@ -695,7 +695,7 @@ def def_method(def_t, name_t, args, def def_endless_method(def_t, name_t, args, assignment_t, body) - n(:def_e, [ value(name_t).to_sym, args, body ], + n(:def, [ value(name_t).to_sym, args, body ], endless_definition_map(def_t, nil, name_t, assignment_t, body)) end @@ -713,7 +713,7 @@ def def_endless_singleton(def_t, definee, dot_t, assignment_t, body) return unless validate_definee(definee) - n(:defs_e, [ definee, value(name_t).to_sym, args, body ], + n(:defs, [ definee, value(name_t).to_sym, args, body ], endless_definition_map(def_t, dot_t, name_t, assignment_t, body)) end diff --git a/lib/parser/meta.rb b/lib/parser/meta.rb index 3267e9f70..48cf0fba2 100644 --- a/lib/parser/meta.rb +++ b/lib/parser/meta.rb @@ -16,7 +16,7 @@ module Meta op_asgn and_asgn ensure rescue arg_expr or_asgn back_ref nth_ref match_with_lvasgn match_current_line - module class sclass def defs def_e defs_e undef alias args + module class sclass def defs undef alias args cbase arg optarg restarg blockarg block_pass kwarg kwoptarg kwrestarg kwnilarg send csend super zsuper yield block and not or if when case while until while_post diff --git a/test/test_parser.rb b/test/test_parser.rb index 63087c6d3..4b777abda 100644 --- a/test/test_parser.rb +++ b/test/test_parser.rb @@ -9578,7 +9578,7 @@ def test_parser_bug_645 def test_endless_method assert_parses( - s(:def_e, :foo, + s(:def, :foo, s(:args), s(:int, 42)), %q{def foo() = 42}, @@ -9589,7 +9589,7 @@ def test_endless_method SINCE_2_8) assert_parses( - s(:def_e, :inc, + s(:def, :inc, s(:args, s(:arg, :x)), s(:send, s(:lvar, :x), :+, @@ -9602,7 +9602,7 @@ def test_endless_method SINCE_2_8) assert_parses( - s(:defs_e, s(:send, nil, :obj), :foo, + s(:defs, s(:send, nil, :obj), :foo, s(:args), s(:int, 42)), %q{def obj.foo() = 42}, @@ -9614,7 +9614,7 @@ def test_endless_method SINCE_2_8) assert_parses( - s(:defs_e, s(:send, nil, :obj), :inc, + s(:defs, s(:send, nil, :obj), :inc, s(:args, s(:arg, :x)), s(:send, s(:lvar, :x), :+, @@ -9631,7 +9631,7 @@ def test_endless_method def test_endless_method_forwarded_args_legacy Parser::Builders::Default.emit_forward_arg = false assert_parses( - s(:def_e, :foo, + s(:def, :foo, s(:forward_args), s(:send, nil, :bar, s(:forwarded_args))), @@ -9661,7 +9661,7 @@ def test_endless_method_without_brackets def test_endless_method_with_rescue_mod assert_parses( - s(:def_e, :m, + s(:def, :m, s(:args), s(:rescue, s(:int, 1), @@ -9672,7 +9672,7 @@ def test_endless_method_with_rescue_mod SINCE_2_8) assert_parses( - s(:defs_e, + s(:defs, s(:self), :m, s(:args), s(:rescue,