-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvements to types and subtyping (#68)
- Loading branch information
1 parent
a1814a5
commit af3b2d0
Showing
52 changed files
with
3,007 additions
and
1,692 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
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#[cfg(feature = "ezno-parser")] | ||
fn main() { | ||
use ezno_checker::{check_project, synthesis}; | ||
use std::{ | ||
collections::HashSet, | ||
env, fs, | ||
path::{Path, PathBuf}, | ||
}; | ||
|
||
let name = env::args().nth(1).unwrap_or_else(|| "examples/test.ts".to_string()); | ||
let path = Path::new(&name); | ||
|
||
let (diagnostics, post_check_data) = check_project::<_, synthesis::EznoParser>( | ||
path.to_path_buf(), | ||
HashSet::from_iter(std::iter::once(ezno_checker::INTERNAL_DEFINITION_FILE_PATH.into())), | ||
|path: &std::path::Path| { | ||
if path == &PathBuf::from(ezno_checker::INTERNAL_DEFINITION_FILE_PATH) { | ||
Some(ezno_checker::INTERNAL_DEFINITION_FILE.to_owned()) | ||
} else { | ||
Some(fs::read_to_string(path).unwrap()) | ||
} | ||
}, | ||
None, | ||
Default::default(), | ||
); | ||
|
||
let args: Vec<_> = env::args().collect(); | ||
|
||
if let Ok(mut post_check_data) = post_check_data { | ||
if args.iter().any(|arg| arg == "--types") { | ||
eprintln!("Types:"); | ||
for item in post_check_data.types.into_vec_temp() { | ||
eprintln!("\t{:?}", item); | ||
} | ||
} | ||
if args.iter().any(|arg| arg == "--events") { | ||
eprintln!("Events on entry:"); | ||
let entry_module = | ||
post_check_data.modules.remove(&post_check_data.entry_source).unwrap(); | ||
for item in entry_module.facts.get_events() { | ||
eprintln!("\t{:?}", item); | ||
} | ||
} | ||
} | ||
|
||
eprintln!("Diagnostics:"); | ||
for diagnostic in diagnostics.into_iter() { | ||
eprintln!("\t{}", diagnostic.reason()) | ||
} | ||
} | ||
|
||
#[cfg(not(feature = "ezno-parser"))] | ||
fn main() { | ||
println!("Requires 'ezno-parser'") | ||
} |
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
Oops, something went wrong.