Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -5148,7 +5148,7 @@ lambda : tLAMBDA[lpar]
CMDARG_POP();
$args = args_with_numbered(p, $args, max_numparam, it_id);
{
YYLTYPE loc = code_loc_gen(&@args, &@body);
YYLTYPE loc = code_loc_gen(&@lpar, &@body);
$$ = NEW_LAMBDA($args, $body->node, &loc, &@lpar, &$body->opening_loc, &$body->closing_loc);
nd_set_line(RNODE_LAMBDA($$)->nd_body, @body.end_pos.lineno);
nd_set_line($$, @args.end_pos.lineno);
Expand Down
7 changes: 0 additions & 7 deletions prism_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -3284,13 +3284,6 @@ pm_scope_node_init(const pm_node_t *node, pm_scope_node_t *scope, pm_scope_node_
scope->parameters = cast->parameters;
scope->body = cast->body;
scope->locals = cast->locals;

if (cast->parameters != NULL) {
scope->base.location.start = cast->parameters->location.start;
}
else {
scope->base.location.start = cast->operator_loc.end;
}
break;
}
case PM_MODULE_NODE: {
Expand Down
4 changes: 2 additions & 2 deletions spec/ruby/core/proc/source_location_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
ruby_version_is("4.0") do
proc { true }.source_location.should == [__FILE__, __LINE__, 11, __LINE__, 19]
Proc.new { true }.source_location.should == [__FILE__, __LINE__, 15, __LINE__, 23]
-> { true }.source_location.should == [__FILE__, __LINE__, 8, __LINE__, 17]
-> { true }.source_location.should == [__FILE__, __LINE__, 6, __LINE__, 17]
end
end

Expand Down Expand Up @@ -98,7 +98,7 @@
location.should == ["foo", 100]
end
ruby_version_is("4.0") do
location.should == ["foo", 100, 2, 100, 5]
location.should == ["foo", 100, 0, 100, 5]
end
end
end
2 changes: 1 addition & 1 deletion test/ruby/test_ast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ def test_error_tolerant_end_is_short_for_do_LAMBDA
args: nil
body:
(LAMBDA@1:0-2:3
(SCOPE@1:2-2:3
(SCOPE@1:0-2:3
tbl: []
args:
(ARGS@1:2-1:2
Expand Down
4 changes: 2 additions & 2 deletions test/ruby/test_lambda.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def test_break
end

def test_do_lambda_source_location
exp = [__LINE__ + 1, 12, __LINE__ + 5, 7]
exp = [__LINE__ + 1, 10, __LINE__ + 5, 7]
lmd = ->(x,
y,
z) do
Expand All @@ -288,7 +288,7 @@ def test_do_lambda_source_location
end

def test_brace_lambda_source_location
exp = [__LINE__ + 1, 12, __LINE__ + 5, 5]
exp = [__LINE__ + 1, 10, __LINE__ + 5, 5]
lmd = ->(x,
y,
z) {
Expand Down
Loading