class

Syntax::Location

Inherits Comparable < Reference < Object

A location of an ASTnode, including its filename, line number and column number.

Constructors

new(filename : String | VirtualFile | Nil, line_number : Int32, column_number : Int32)
Source

Instance methods

<=>(other)
Source
between?(min, max)
Source
column_number
Source
dirname

Returns the directory name of this location's filename. If the filename is a VirtualFile, this is invoked on its expanded location.

Source
expanded_location

Returns the Location whose filename is a String, not a VirtualFile, traversing virtual file expanded locations.

Source
filename
Source
inspect(io : IO) : Nil

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>
Source
line_number
Source
macro_location

Returns the Location whose filename is a String, not a VirtualFile, traversing virtual file expanded locations leading to the original user source code

Source
original_filename

Returns the filename of the expanded_location

Source
pretty_print(pp)
Source
to_s(io : IO) : Nil

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Source