summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/prism/debug.rb18
-rw-r--r--prism/prism.c5
-rw-r--r--test/prism/locals_test.rb20
3 files changed, 5 insertions, 38 deletions
diff --git a/lib/prism/debug.rb b/lib/prism/debug.rb
index 24a27d07ef..f4c0bcf91a 100644
--- a/lib/prism/debug.rb
+++ b/lib/prism/debug.rb
@@ -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
diff --git a/prism/prism.c b/prism/prism.c
index 1c1b53f787..4d2602cdb9 100644
--- a/prism/prism.c
+++ b/prism/prism.c
@@ -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);
}
diff --git a/test/prism/locals_test.rb b/test/prism/locals_test.rb
index 3dbe58f64d..e7322b0314 100644
--- a/test/prism/locals_test.rb
+++ b/test/prism/locals_test.rb
@@ -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