зеркало из https://github.com/github/ruby.git
[ruby/yarp] Fix endless method definitions binding power to accept args (#8051)
This commit is contained in:
Родитель
880b29b74b
Коммит
53c5601565
|
@ -0,0 +1,5 @@
|
|||
def foo = 1
|
||||
|
||||
def bar = A ""
|
||||
|
||||
def method = 1 + 2 + 3
|
|
@ -0,0 +1,80 @@
|
|||
ProgramNode(0...51)(
|
||||
[],
|
||||
StatementsNode(0...51)(
|
||||
[DefNode(0...11)(
|
||||
(4...7),
|
||||
nil,
|
||||
nil,
|
||||
StatementsNode(10...11)([IntegerNode(10...11)()]),
|
||||
[],
|
||||
(0...3),
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
(8...9),
|
||||
nil
|
||||
),
|
||||
DefNode(13...27)(
|
||||
(17...20),
|
||||
nil,
|
||||
nil,
|
||||
StatementsNode(23...27)(
|
||||
[CallNode(23...27)(
|
||||
nil,
|
||||
nil,
|
||||
(23...24),
|
||||
nil,
|
||||
ArgumentsNode(25...27)(
|
||||
[StringNode(25...27)((25...26), (26...26), (26...27), "")]
|
||||
),
|
||||
nil,
|
||||
nil,
|
||||
0,
|
||||
"A"
|
||||
)]
|
||||
),
|
||||
[],
|
||||
(13...16),
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
(21...22),
|
||||
nil
|
||||
),
|
||||
DefNode(29...51)(
|
||||
(33...39),
|
||||
nil,
|
||||
nil,
|
||||
StatementsNode(42...51)(
|
||||
[CallNode(42...51)(
|
||||
CallNode(42...47)(
|
||||
IntegerNode(42...43)(),
|
||||
nil,
|
||||
(44...45),
|
||||
nil,
|
||||
ArgumentsNode(46...47)([IntegerNode(46...47)()]),
|
||||
nil,
|
||||
nil,
|
||||
0,
|
||||
"+"
|
||||
),
|
||||
nil,
|
||||
(48...49),
|
||||
nil,
|
||||
ArgumentsNode(50...51)([IntegerNode(50...51)()]),
|
||||
nil,
|
||||
nil,
|
||||
0,
|
||||
"+"
|
||||
)]
|
||||
),
|
||||
[],
|
||||
(29...32),
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
(40...41),
|
||||
nil
|
||||
)]
|
||||
)
|
||||
)
|
|
@ -10941,7 +10941,7 @@ parse_expression_prefix(yp_parser_t *parser, yp_binding_power_t binding_power) {
|
|||
context_push(parser, YP_CONTEXT_DEF);
|
||||
statements = (yp_node_t *) yp_statements_node_create(parser);
|
||||
|
||||
yp_node_t *statement = parse_expression(parser, YP_BINDING_POWER_ASSIGNMENT + 1, "Expected to be able to parse body of endless method definition.");
|
||||
yp_node_t *statement = parse_expression(parser, YP_BINDING_POWER_DEFINED + 1, "Expected to be able to parse body of endless method definition.");
|
||||
|
||||
if (accept(parser, YP_TOKEN_KEYWORD_RESCUE_MODIFIER)) {
|
||||
yp_token_t rescue_keyword = parser->previous;
|
||||
|
|
Загрузка…
Ссылка в новой задаче