mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 02:00:51 +00:00
Fixing issue with wasm-interpreter
This commit is contained in:
parent
c82253ca68
commit
554ef90035
@ -3,6 +3,7 @@
|
||||
|
||||
#![doc(hidden)]
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
use crate::{Clamped, JsValue};
|
||||
|
||||
macro_rules! tys {
|
||||
@ -54,7 +55,7 @@ pub trait WasmDescribe {
|
||||
}
|
||||
|
||||
macro_rules! simple {
|
||||
($($t:ident => $d:expr)*) => ($(
|
||||
($($t:ident => $d:ident)*) => ($(
|
||||
impl WasmDescribe for $t {
|
||||
fn describe() { inform($d) }
|
||||
}
|
||||
@ -76,10 +77,22 @@ simple! {
|
||||
f64 => F64
|
||||
bool => BOOLEAN
|
||||
char => CHAR
|
||||
str => if cfg!(feature = "enable-interning") { CACHED_STRING } else { STRING }
|
||||
JsValue => ANYREF
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "enable-interning")] {
|
||||
simple! {
|
||||
str => CACHED_STRING
|
||||
}
|
||||
|
||||
} else {
|
||||
simple! {
|
||||
str => STRING
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> WasmDescribe for *const T {
|
||||
fn describe() {
|
||||
inform(I32)
|
||||
@ -116,8 +129,17 @@ impl<'a, T: WasmDescribe + ?Sized> WasmDescribe for &'a mut T {
|
||||
if_std! {
|
||||
use std::prelude::v1::*;
|
||||
|
||||
impl WasmDescribe for String {
|
||||
fn describe() { inform(if cfg!(feature = "enable-interning") { CACHED_STRING } else { STRING }) }
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "enable-interning")] {
|
||||
simple! {
|
||||
String => CACHED_STRING
|
||||
}
|
||||
|
||||
} else {
|
||||
simple! {
|
||||
String => STRING
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: WasmDescribe> WasmDescribe for Box<[T]> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user