зеркало из https://github.com/github/ruby.git
[ruby/prism] Fix Ruby head build
https://github.com/ruby/prism/commit/149e2ff7f6
This commit is contained in:
Родитель
fdb8f08639
Коммит
ebf803aa19
|
@ -59,21 +59,7 @@ module Prism
|
|||
stack = [ISeq.new(RubyVM::InstructionSequence.compile(source).to_a)]
|
||||
|
||||
while (iseq = stack.pop)
|
||||
names = [*iseq.local_table]
|
||||
names.map!.with_index do |name, index|
|
||||
# When an anonymous local variable is present in the iseq's local
|
||||
# table, it is represented as the stack offset from the top.
|
||||
# However, when these are dumped to binary and read back in, they
|
||||
# are replaced with the symbol :#arg_rest. To consistently handle
|
||||
# this, we replace them here with their index.
|
||||
if name == :"#arg_rest"
|
||||
names.length - index + 1
|
||||
else
|
||||
name
|
||||
end
|
||||
end
|
||||
|
||||
locals << names
|
||||
locals << iseq.local_table
|
||||
iseq.each_child { |child| stack << child }
|
||||
end
|
||||
|
||||
|
@ -141,7 +127,7 @@ module Prism
|
|||
sorted << AnonymousLocal if params.keywords.any?
|
||||
|
||||
if params.keyword_rest.is_a?(ForwardingParameterNode)
|
||||
sorted.push(:*, :&, :"...")
|
||||
sorted.push(:*, :**, :&, :"...")
|
||||
elsif params.keyword_rest.is_a?(KeywordRestParameterNode)
|
||||
sorted << params.keyword_rest.name if params.keyword_rest.name
|
||||
end
|
||||
|
|
|
@ -3999,9 +3999,8 @@ pm_keyword_hash_node_create(pm_parser_t *parser) {
|
|||
*/
|
||||
static void
|
||||
pm_keyword_hash_node_elements_append(pm_keyword_hash_node_t *hash, pm_node_t *element) {
|
||||
// If the element being added is not an AssocNode or does not have a symbol key, then
|
||||
// we want to turn the STATIC_KEYS flag off.
|
||||
// TODO: Rename the flag to SYMBOL_KEYS instead.
|
||||
// If the element being added is not an AssocNode or does not have a symbol
|
||||
// key, then we want to turn the SYMBOL_KEYS flag off.
|
||||
if (!PM_NODE_TYPE_P(element, PM_ASSOC_NODE) || !PM_NODE_TYPE_P(((pm_assoc_node_t *) element)->key, PM_SYMBOL_NODE)) {
|
||||
pm_node_flag_unset((pm_node_t *)hash, PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#
|
||||
# There have also been changes made in other versions of Ruby, so we only want
|
||||
# to test on the most recent versions.
|
||||
return if !defined?(RubyVM::InstructionSequence) || RUBY_VERSION < "3.2"
|
||||
return if !defined?(RubyVM::InstructionSequence) || RUBY_VERSION < "3.4.0"
|
||||
|
||||
# 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
|
||||
|
@ -57,24 +57,6 @@ module Prism
|
|||
# Dead code eliminated
|
||||
invalid << "whitequark/ruby_bug_10653.txt"
|
||||
|
||||
# case :a
|
||||
# in Symbol(*lhs, x, *rhs)
|
||||
# end
|
||||
todos << "seattlerb/case_in.txt"
|
||||
|
||||
# <<~HERE
|
||||
# #{<<~THERE}
|
||||
# THERE
|
||||
# HERE
|
||||
todos << "seattlerb/heredoc_nested.txt"
|
||||
|
||||
# Ruby < 3.3.0 fails to parse:
|
||||
#
|
||||
# <<-' HERE'
|
||||
# foo
|
||||
# HERE
|
||||
invalid << "heredocs_leading_whitespace.txt" if RUBY_VERSION < "3.3.0"
|
||||
|
||||
base = File.join(__dir__, "fixtures")
|
||||
skips = invalid | todos
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче