summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGopal Patel <[email protected]>2024-02-20 13:48:31 -0800
committergit <[email protected]>2024-02-24 03:39:28 +0000
commitdfee03374632f4da40587cf62858b92da5022a9a ()
treea24a55c2209b4c9a2ba9a9560f99ec82cbb9efa4
parent66565e36eae8a3dff53f86b3d04bf749e0b07a94 (diff)
[ruby/prism] Replace awkward code changes with steep:ignore
Also remove RBS for currently ignored files. Will follow-up when those check fully in later PRs. https://.com/ruby/prism/commit/2cae58f86d
-rw-r--r--lib/prism.rb4
-rw-r--r--lib/prism/parse_result/comments.rb7
-rw-r--r--lib/prism/parse_result/newlines.rb6
-rw-r--r--lib/prism/pattern.rb3
-rw-r--r--lib/prism/prism.gemspec1
-rw-r--r--lib/prism/translation.rb2
-rwxr-xr-xprism/templates/template.rb3
7 files changed, 7 insertions, 19 deletions
@@ -44,7 +44,7 @@ module Prism
#
# For supported options, see Prism::parse.
def self.lex_compat(source, **options)
- LexCompat.new(source, **options).result #: ParseResult[Array[[[Integer, Integer], Symbol, String, untyped]]]
end
# :call-seq:
@@ -54,7 +54,7 @@ module Prism
# returns the same tokens. Raises SyntaxError if the syntax in source is
# invalid.
def self.lex_ripper(source)
- LexRipper.new(source).result
end
# :call-seq:
@@ -188,12 +188,7 @@ module Prism
# Attach the list of comments to their respective locations in the tree.
def attach_comments!
- if ProgramNode === value
- this = self #: ParseResult[ProgramNode]
- Comments.new(this).attach!
- else
- raise
- end
end
end
end
@@ -58,11 +58,7 @@ module Prism
# Walk the tree and mark nodes that are on a new line.
def mark_newlines!
- if ProgramNode === value
- value.accept(Newlines.new(Array.new(1 + source.offsets.size, false)))
- else
- raise "ParseResult does not contain ProgramNode value"
- end
end
end
end
@@ -87,11 +87,10 @@ module Prism
return to_enum(__method__ || raise, root) unless block_given?
@compiled ||= compile
- compiled = @compiled #: Proc
queue = [root]
while (node = queue.shift)
- yield node if compiled.call(node)
queue.concat(node.compact_child_nodes)
end
end
@@ -133,7 +133,6 @@ Gem::Specification.new do |spec|
"sig/prism/pack.rbs",
"sig/prism/parse_result.rbs",
"sig/prism/pattern.rbs",
- "sig/prism/ripper_compat.rbs",
"sig/prism/serialize.rbs",
"sig/prism/visitor.rbs",
"rbi/prism.rbi",
@@ -3,7 +3,7 @@
module Prism
# This module is responsible for converting the prism syntax tree into other
# syntax trees.
- module Translation
autoload :Parser, "prism/translation/parser"
autoload :Ripper, "prism/translation/ripper"
autoload :RubyParser, "prism/translation/ruby_parser"
@@ -588,8 +588,7 @@ module Prism
"sig/prism/mutation_compiler.rbs",
"sig/prism/node.rbs",
"sig/prism/visitor.rbs",
- "sig/prism/_private/dot_visitor.rbs",
- "sig/prism/_private/ripper_compat.rbs",
]
end