summaryrefslogtreecommitdiff
path: root/lib/prism
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 (patch)
treec628ff4d6e08926e06c29b56ac0fa2b7acdf9d5b /lib/prism
parent2bf9ae3fa1b5dec1c63176f39db84d697ede3581 (diff)
[ruby/prism] Various cleanup for initializers and typechecks
https://github.com/ruby/prism/commit/86cf82794a
Diffstat (limited to 'lib/prism')
-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
diff --git a/lib/prism/parse_result.rb b/lib/prism/parse_result.rb
index ae57242707..df1d66f44c 100644
--- a/lib/prism/parse_result.rb
+++ b/lib/prism/parse_result.rb
@@ -588,6 +588,7 @@ module Prism
autoload :Newlines, "prism/parse_result/newlines"
private_constant :Comments
+ private_constant :Errors
private_constant :Newlines
# The syntax tree that was parsed from the source code.
diff --git a/lib/prism/parse_result/errors.rb b/lib/prism/parse_result/errors.rb
index 1eaeebee6e..847a8442fe 100644
--- a/lib/prism/parse_result/errors.rb
+++ b/lib/prism/parse_result/errors.rb
@@ -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
diff --git a/lib/prism/prism.gemspec b/lib/prism/prism.gemspec
index 750af194a8..08212318bc 100644
--- a/lib/prism/prism.gemspec
+++ b/lib/prism/prism.gemspec
@@ -104,6 +104,7 @@ Gem::Specification.new do |spec|
"prism.gemspec",
"rbi/prism.rbi",
"rbi/prism/compiler.rbi",
+ "rbi/prism/dsl.rbi",
"rbi/prism/inspect_visitor.rbi",
"rbi/prism/node_ext.rbi",
"rbi/prism/node.rbi",