[ruby/prism] When parsing an invalid write, still add to the local table

https://github.com/ruby/prism/commit/a54abc4d1b
This commit is contained in:
Kevin Newton 2024-07-12 09:27:32 -04:00 коммит произвёл git
Родитель ca99f86bd6
Коммит 6298667ff5
2 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -13695,7 +13695,7 @@ parse_unwriteable_write(pm_parser_t *parser, pm_node_t *target, const pm_token_t
default: break;
}
pm_constant_id_t name = pm_parser_constant_id_location(parser, target->location.start, target->location.end);
pm_constant_id_t name = pm_parser_local_add_location(parser, target->location.start, target->location.end, 1);
pm_local_variable_write_node_t *result = pm_local_variable_write_node_create(parser, name, 0, value, &target->location, equals);
pm_node_destroy(parser, target);

Просмотреть файл

@ -9,6 +9,11 @@
# to test on the most recent versions.
return if !defined?(RubyVM::InstructionSequence) || RUBY_VERSION < "3.4.0"
# In Ruby 3.4.0, the local table for method forwarding changed. But 3.4.0 can
# refer to the dev version, so while 3.4.0 still isn't released, we need to
# check if we have a high enough revision.
return if RubyVM::InstructionSequence.compile("def foo(...); end").to_a[13][2][2][10].length != 1
# Omit tests if running on a 32-bit machine because there is a bug with how
# Ruby is handling large ISeqs on 32-bit machines
return if RUBY_PLATFORM =~ /i686/