Skip to content

Commit

Permalink
Fix and support windows drive letters for root folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Vici37 committed Nov 25, 2024
1 parent b1d68f3 commit 25531e1
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/compiler/crystal/tools/typer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -508,19 +508,12 @@ module Crystal
@line_locators << loc[0] unless loc["col_number"]?
@line_and_column_locators << loc[0] if loc["line_number"]? && loc["col_number"]?
end

pp! @dir_locators
pp! @file_locators
pp! @line_locators
pp! @line_and_column_locators
end

def visit(node : Crystal::Def)
return false unless loc = node.location
return false unless loc.filename && loc.line_number && loc.column_number
pp! loc
if node_in_def_locators(loc)
puts "Accepted"
all_defs << node
files << loc.filename.to_s
end
Expand All @@ -533,7 +526,7 @@ module Crystal
end

private def node_in_def_locators(location : Crystal::Location) : Bool
return false unless location.to_s.starts_with?("/")
return false unless location.to_s.starts_with?("/") || location.to_s.starts_with?(/\w:/)
return true if @dir_locators.any? { |d| location.filename.to_s.starts_with?(d) }
return true if @file_locators.includes?(location.filename)
return true if @line_locators.includes?("#{location.filename}:#{location.line_number}")
Expand Down

0 comments on commit 25531e1

Please sign in to comment.