summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-07-03 11:23:17 -0400
committerKevin Newton <[email protected]>2024-07-11 14:25:54 -0400
commitaa473489a2ff5e5ed6d3536466e6108539c97a8b ()
treec628ff4d6e08926e06c29b56ac0fa2b7acdf9d5b /lib
parent2bf9ae3fa1b5dec1c63176f39db84d697ede3581 (diff)
[ruby/prism] Various cleanup for initializers and typechecks
https://.com/ruby/prism/commit/86cf82794a
-rw-r--r--lib/prism/parse_result.rb1
-rw-r--r--lib/prism/parse_result/errors.rb10
-rw-r--r--lib/prism/prism.gemspec1
3 files changed, 7 insertions, 5 deletions
@@ -588,6 +588,7 @@ module Prism
autoload :Newlines, "prism/parse_result/newlines"
private_constant :Comments
private_constant :Newlines
# The syntax tree that was parsed from the source code.
@@ -32,19 +32,19 @@ module Prism
io = StringIO.new
source_lines.each.with_index(1) do |line, line_number|
io.puts(line)
-
(error_lines.delete(line_number) || []).each do |error|
location = error.location
-
case line_number
when location.start_line
io.print(" " * location.start_column + "^")
-
if location.start_line == location.end_line
if location.start_column != location.end_column
io.print("~" * (location.end_column - location.start_column - 1))
end
-
io.puts(" " + error.message)
else
io.puts("~" * (line.bytesize - location.start_column))
@@ -56,7 +56,7 @@ module Prism
end
end
end
-
io.puts
io.string
end
@@ -104,6 +104,7 @@ Gem::Specification.new do |spec|
"prism.gemspec",
"rbi/prism.rbi",
"rbi/prism/compiler.rbi",
"rbi/prism/inspect_visitor.rbi",
"rbi/prism/node_ext.rbi",
"rbi/prism/node.rbi",