Support compiling to WASM.
This commit is contained in:
@@ -24,6 +24,8 @@ use crate::stdlib::{
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[cfg(not(target_arch = "wasm64"))]
|
||||
use crate::stdlib::time::Instant;
|
||||
|
||||
/// Trait to represent any type.
|
||||
@@ -192,6 +194,8 @@ impl Dynamic {
|
||||
Union::Module(_) => "sub-scope",
|
||||
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[cfg(not(target_arch = "wasm64"))]
|
||||
Union::Variant(value) if value.is::<Instant>() => "timestamp",
|
||||
Union::Variant(value) => (***value).type_name(),
|
||||
}
|
||||
@@ -215,6 +219,8 @@ impl fmt::Display for Dynamic {
|
||||
Union::Module(value) => fmt::Debug::fmt(value, f),
|
||||
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[cfg(not(target_arch = "wasm64"))]
|
||||
Union::Variant(value) if value.is::<Instant>() => write!(f, "<timestamp>"),
|
||||
Union::Variant(_) => write!(f, "?"),
|
||||
}
|
||||
@@ -238,6 +244,8 @@ impl fmt::Debug for Dynamic {
|
||||
Union::Module(value) => fmt::Debug::fmt(value, f),
|
||||
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[cfg(not(target_arch = "wasm64"))]
|
||||
Union::Variant(value) if value.is::<Instant>() => write!(f, "<timestamp>"),
|
||||
Union::Variant(_) => write!(f, "<dynamic>"),
|
||||
}
|
||||
|
@@ -27,6 +27,8 @@ use crate::stdlib::{
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[cfg(not(target_arch = "wasm64"))]
|
||||
use crate::stdlib::{fs::File, io::prelude::*, path::PathBuf};
|
||||
|
||||
/// Engine public API
|
||||
|
@@ -6,6 +6,8 @@ use super::math_basic::BasicMathPackage;
|
||||
use super::pkg_core::CorePackage;
|
||||
use super::string_more::MoreStringPackage;
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[cfg(not(target_arch = "wasm64"))]
|
||||
use super::time_basic::BasicTimePackage;
|
||||
|
||||
use crate::def_package;
|
||||
@@ -18,6 +20,8 @@ def_package!(crate:StandardPackage:"_Standard_ package containing all built-in f
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
BasicMapPackage::init(lib);
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[cfg(not(target_arch = "wasm64"))]
|
||||
BasicTimePackage::init(lib);
|
||||
MoreStringPackage::init(lib);
|
||||
});
|
||||
|
@@ -1,3 +1,6 @@
|
||||
#![cfg(not(target_arch = "wasm32"))]
|
||||
#![cfg(not(target_arch = "wasm64"))]
|
||||
|
||||
use super::logic::{eq, gt, gte, lt, lte, ne};
|
||||
use super::math_basic::MAX_INT;
|
||||
|
||||
|
Reference in New Issue
Block a user