Skip to content

Commit

Permalink
Move filename and some file location methods under to Crystal::Macros…
Browse files Browse the repository at this point in the history
…::ASTNode
makenowjust authored and Ary Borenszweig committed Nov 30, 2016

Verified

This commit was signed with the committer’s verified signature. The key has expired.
nomadium Miguel Landaeta
1 parent c94094c commit 760268b
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions src/compiler/crystal/macros.cr
Original file line number Diff line number Diff line change
@@ -75,39 +75,6 @@ module Crystal::Macros
def run(filename, *args) : MacroId
end

# Returns the filename where this node is located.
# Might return nil if the location is not known.
def filename : StringLiteral | NilLiteral
end

# Returns the line number where this node begins.
# Might return nil if the location is not known.
#
# The first line number in a file is 1.
def line_number : StringLiteral | NilLiteral
end

# Returns the column number where this node begins.
# Might return nil if the location is not known.
#
# The first column number in a line is 1.
def column_number : StringLiteral | NilLiteral
end

# Returns the line number where this node ends.
# Might return nil if the location is not known.
#
# The first line number in a file is 1.
def end_line_number : StringLiteral | NilLiteral
end

# Returns the column number where this node ends.
# Might return nil if the location is not known.
#
# The first column number in a line is 1.
def end_column_number : StringLiteral | NilLiteral
end

# This is the base class of all AST nodes. This methods are
# available to all AST nodes.
abstract class ASTNode
@@ -157,6 +124,39 @@ module Crystal::Macros
def class_name : StringLiteral
end

# Returns the filename where this node is located.
# Might return nil if the location is not known.
def filename : StringLiteral | NilLiteral
end

# Returns the line number where this node begins.
# Might return nil if the location is not known.
#
# The first line number in a file is 1.
def line_number : StringLiteral | NilLiteral
end

# Returns the column number where this node begins.
# Might return nil if the location is not known.
#
# The first column number in a line is 1.
def column_number : StringLiteral | NilLiteral
end

# Returns the line number where this node ends.
# Might return nil if the location is not known.
#
# The first line number in a file is 1.
def end_line_number : StringLiteral | NilLiteral
end

# Returns the column number where this node ends.
# Might return nil if the location is not known.
#
# The first column number in a line is 1.
def end_column_number : StringLiteral | NilLiteral
end

# Returns true if this node's textual representation is the same as
# the other node.
def ==(other : ASTNode) : BoolLiteral

0 comments on commit 760268b

Please sign in to comment.