| 
									
										
										
										
											2023-08-08 13:54:59 -07:00
										 |  |  | # typed: strict | 
					
						
							| 
									
										
										
										
											2023-05-19 19:43:15 +02:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module Homebrew | 
					
						
							|  |  |  |   # A location in source code. | 
					
						
							|  |  |  |   class SourceLocation | 
					
						
							|  |  |  |     sig { returns(Integer) } | 
					
						
							|  |  |  |     attr_reader :line | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     sig { returns(T.nilable(Integer)) } | 
					
						
							|  |  |  |     attr_reader :column | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     sig { params(line: Integer, column: T.nilable(Integer)).void } | 
					
						
							| 
									
										
										
										
											2024-08-18 16:28:17 -07:00
										 |  |  |     def initialize(line, column = nil) | 
					
						
							| 
									
										
										
										
											2023-05-19 19:43:15 +02:00
										 |  |  |       @line = line | 
					
						
							|  |  |  |       @column = column | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     sig { returns(String) } | 
					
						
							|  |  |  |     def to_s | 
					
						
							|  |  |  |       "#{line}#{column&.to_s&.prepend(":")}" | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |