mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-12 15:16:06 +00:00
Fix compat with current nightly
This commit is contained in:
parent
6d5ebaf5ac
commit
b7bbcf5ea9
@ -1,3 +1,4 @@
|
|||||||
|
use proc_macro2::TokenTree;
|
||||||
use quote::{ToTokens, Tokens};
|
use quote::{ToTokens, Tokens};
|
||||||
use shared;
|
use shared;
|
||||||
use syn;
|
use syn;
|
||||||
@ -757,7 +758,16 @@ impl BindgenAttrs {
|
|||||||
Some(i) => i,
|
Some(i) => i,
|
||||||
None => return BindgenAttrs::default(),
|
None => return BindgenAttrs::default(),
|
||||||
};
|
};
|
||||||
syn::parse(attrs.remove(pos).tts.into()).expect("malformed #[wasm_bindgen] attribute")
|
let mut tts = attrs.remove(pos).tts.into_iter();
|
||||||
|
let tt = match tts.next() {
|
||||||
|
Some(TokenTree::Group(d)) => d.stream(),
|
||||||
|
Some(_) => panic!("malformed #[wasm_bindgen] attribute"),
|
||||||
|
None => return BindgenAttrs::default(),
|
||||||
|
};
|
||||||
|
if tts.next().is_some() {
|
||||||
|
panic!("malformed #[wasm_bindgen] attribute");
|
||||||
|
}
|
||||||
|
syn::parse(tt.into()).expect("malformed #[wasm_bindgen] attribute")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn module(&self) -> Option<&str> {
|
fn module(&self) -> Option<&str> {
|
||||||
@ -859,11 +869,11 @@ impl BindgenAttrs {
|
|||||||
impl syn::synom::Synom for BindgenAttrs {
|
impl syn::synom::Synom for BindgenAttrs {
|
||||||
named!(parse -> Self, alt!(
|
named!(parse -> Self, alt!(
|
||||||
do_parse!(
|
do_parse!(
|
||||||
opts: parens!(call!(
|
opts: call!(
|
||||||
syn::punctuated::Punctuated::<_, syn::token::Comma>::parse_terminated
|
syn::punctuated::Punctuated::<_, syn::token::Comma>::parse_terminated
|
||||||
)) >>
|
) >>
|
||||||
(BindgenAttrs {
|
(BindgenAttrs {
|
||||||
attrs: opts.1.into_iter().collect(),
|
attrs: opts.into_iter().collect(),
|
||||||
})
|
})
|
||||||
) => { |s| s }
|
) => { |s| s }
|
||||||
|
|
|
|
||||||
|
@ -109,6 +109,13 @@ impl ToTokens for ast::Struct {
|
|||||||
(quote! {
|
(quote! {
|
||||||
impl ::wasm_bindgen::describe::WasmDescribe for #name {
|
impl ::wasm_bindgen::describe::WasmDescribe for #name {
|
||||||
fn describe() {
|
fn describe() {
|
||||||
|
use wasm_bindgen::__wbindgen_if_not_std;
|
||||||
|
__wbindgen_if_not_std! {
|
||||||
|
compile_error! {
|
||||||
|
"exporting a class to JS requires the `std` feature to \
|
||||||
|
be enabled in the `wasm-bindgen` crate"
|
||||||
|
}
|
||||||
|
}
|
||||||
use wasm_bindgen::describe::*;
|
use wasm_bindgen::describe::*;
|
||||||
inform(RUST_STRUCT);
|
inform(RUST_STRUCT);
|
||||||
inform(#name_len);
|
inform(#name_len);
|
||||||
@ -116,13 +123,6 @@ impl ToTokens for ast::Struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
::wasm_bindgen::__wbindgen_if_not_std! {
|
|
||||||
compile_error! {
|
|
||||||
"exporting a class to JS requires the `std` feature to \
|
|
||||||
be enabled in the `wasm-bindgen` crate"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ::wasm_bindgen::convert::IntoWasmAbi for #name {
|
impl ::wasm_bindgen::convert::IntoWasmAbi for #name {
|
||||||
type Abi = u32;
|
type Abi = u32;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user