moved all crates into seperate folder + related path fixes

This commit is contained in:
Anton-4 2022-07-01 17:37:43 +02:00
parent 12ef03bb86
commit eee85fa45d
No known key found for this signature in database
GPG key ID: C954D6E0F9C0ABFD
1063 changed files with 92 additions and 93 deletions

View file

@ -0,0 +1,42 @@
#![cfg(target_family = "wasm")]
/*
For the Web REPL (repl_www), we build the compiler as a Wasm module.
SystemTime is the only thing in the compiler that would need a special implementation for this.
There is a WASI implementation for it, but we are targeting the browser, not WASI!
It's possible to write browser versions of WASI's low-level ABI but we'd rather avoid it.
Instead we use these dummy implementations, which should just disappear at compile time.
*/
#[derive(Debug, Clone, Copy)]
pub struct SystemTime;
impl SystemTime {
pub fn now() -> Self {
SystemTime
}
pub fn duration_since(&self, _: SystemTime) -> Result<Duration, String> {
Ok(Duration)
}
pub fn elapsed(&self) -> Result<Duration, String> {
Ok(Duration)
}
}
#[derive(Debug, Clone, Copy)]
pub struct Duration;
impl Duration {
pub fn checked_sub(&self, _: Duration) -> Option<Duration> {
Some(Duration)
}
}
impl Default for Duration {
fn default() -> Self {
Duration
}
}
impl std::ops::AddAssign for Duration {
fn add_assign(&mut self, _: Duration) {}
}