Compare commits

...

2 Commits

Author SHA1 Message Date
Sasha Koshka
abc6e44fb2 Removed Location's dependency on Error 2022-08-18 00:50:57 -04:00
Sasha Koshka
cce841f48e Add getters to File 2022-08-18 00:50:39 -04:00
2 changed files with 10 additions and 5 deletions

View File

@ -111,3 +111,13 @@ func (file *File) Location (width int) (location Location) {
width: width, width: width,
} }
} }
// Path returns the path that teh file is located at.
func (file *File) Path () (path string) {
return file.path
}
// GetLine returns the line at the specified index.
func (file *File) GetLine (index int) (line string) {
return file.lines[index]
}

View File

@ -9,11 +9,6 @@ type Location struct {
width int width int
} }
// NewError creates a new error at this location.
func (location Location) NewError (message string, kind ErrorKind) (err Error) {
return NewError(location, message, kind)
}
// File returns the file the location is in // File returns the file the location is in
func (location Location) File () (file *File) { func (location Location) File () (file *File) {
return location.file return location.file