-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started cleaning up and refactoring workspace compilation code
- Loading branch information
1 parent
202ada2
commit de6c7f5
Showing
4 changed files
with
279 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
use crate::source_files::{Source, SourceFiles}; | ||
use crate::source_files::SourceFiles; | ||
|
||
pub trait Show { | ||
fn show(&self, w: &mut dyn std::fmt::Write, source_files: &SourceFiles) -> std::fmt::Result; | ||
|
||
fn eprintln(self: &Self, source_files: &SourceFiles) { | ||
let mut message = String::new(); | ||
self.show(&mut message, source_files).unwrap(); | ||
eprintln!("{}", message); | ||
} | ||
} | ||
|
||
pub fn into_show<T: Show + 'static>(show: T) -> Box<dyn Show> { | ||
Box::new(show) | ||
} | ||
|
||
pub fn error_println(message: &str, source: Source, source_files: &SourceFiles) { | ||
eprintln!( | ||
"{}:{}:{}: error: {}", | ||
source_files.get(source.key).filename(), | ||
source.location.line, | ||
source.location.column, | ||
message, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.