Skip to content

Commit

Permalink
Always use whitequark parser
Browse files Browse the repository at this point in the history
  • Loading branch information
castwide committed Jan 15, 2025
1 parent 71b7a7d commit 5b4e2ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/solargraph/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class SyntaxError < StandardError
# True if the parser can use RubyVM.
#
def self.rubyvm?
!!defined?(RubyVM::AbstractSyntaxTree)
# false
# !!defined?(RubyVM::AbstractSyntaxTree)
false
end

selected = rubyvm? ? Rubyvm : Legacy
Expand Down
6 changes: 2 additions & 4 deletions lib/solargraph/range.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ def self.from_to l1, c1, l2, c2
# @param node [RubyVM::AbstractSyntaxTree::Node, Parser::AST::Node]
# @return [Range]
def self.from_node node
if defined?(RubyVM::AbstractSyntaxTree::Node)
if node.is_a?(RubyVM::AbstractSyntaxTree::Node)
Solargraph::Range.from_to(node.first_lineno - 1, node.first_column, node.last_lineno - 1, node.last_column)
end
if Parser.rubyvm? && node.is_a?(RubyVM::AbstractSyntaxTree::Node)
Solargraph::Range.from_to(node.first_lineno - 1, node.first_column, node.last_lineno - 1, node.last_column)
elsif node&.loc && node.loc.expression
from_expr(node.loc.expression)
end
Expand Down

0 comments on commit 5b4e2ff

Please sign in to comment.