diff --git a/src/ast.cr b/src/ast.cr index 15858542..e97ddf98 100644 --- a/src/ast.cr +++ b/src/ast.cr @@ -21,27 +21,12 @@ module Mint @nodes = [] of Node) end - def main : Component? - @components.find(&.name.value.==("Main")) - end - - # TODO: Use line / column instead of offset def self.space_separated?(node1, node2) - node1.file.contents[node1.to.offset, node2.from.offset - node1.to.offset].count('\n') > 1 - end - - def self.new_line?(node1, node2) - node1.file.contents[node1.from.offset, node2.from.offset - node1.from.offset].includes?('\n') + (node2.from.line - node1.to.line) > 1 end - def new_line?(node1, node2) - start_position = - node1.from.offset - - count = - node2.to.offset - node1.from.offset - - node1.file.contents[start_position, count].includes?('\n') + def main : Component? + @components.find(&.name.value.==("Main")) end def merge(ast) : self