зеркало из https://github.com/github/ruby.git
[PRISM] Fix lambda start column number
Co-Authored-By: Kevin Newton <kddnewton@gmail.com>
This commit is contained in:
Родитель
b662edf0a0
Коммит
d357d50f0a
|
@ -2510,6 +2510,13 @@ 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: {
|
||||
|
|
|
@ -1838,6 +1838,15 @@ end
|
|||
assert_prism_eval("-> { to_s }.call")
|
||||
end
|
||||
|
||||
def test_LambdaNode_with_multiline_args
|
||||
assert_prism_eval(<<-CODE)
|
||||
-> (a,
|
||||
b) {
|
||||
a + b
|
||||
}.call(1, 2)
|
||||
CODE
|
||||
end
|
||||
|
||||
def test_ModuleNode
|
||||
assert_prism_eval("module M; end")
|
||||
assert_prism_eval("module M::N; end")
|
||||
|
|
Загрузка…
Ссылка в новой задаче