Skip to content

Commit

Permalink
Fix minor issues on JRuby.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Jan 25, 2024
1 parent dab5742 commit edcd84a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/bake/recipe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def initialize(instance, name, method = nil)

# Sort by location in source file.
def <=> other
self.source_location <=> other.source_location
(self.source_location || []) <=> (other.source_location || [])
end

# The method implementation.
Expand Down Expand Up @@ -162,7 +162,12 @@ def compute_command
COMMENT = /\A\s*\#\s?(.*?)\Z/

def read_comments
file, line_number = self.method.source_location
unless source_location = self.method&.source_location
# Bail early if we don't have a source location (there are some inconsequential cases on JRuby):
return []
end

file, line_number = source_location

lines = File.readlines(file)
line_index = line_number - 1
Expand Down

0 comments on commit edcd84a

Please sign in to comment.