Update dependencies

This commit is contained in:
Alex Crichton 2018-04-03 07:07:14 -07:00
parent e6a483f906
commit 782378e7c0
7 changed files with 54 additions and 56 deletions

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Nick Fitzgerald <fitzgen@gmail.com>"]
[dependencies]
quote = '0.4'
proc-macro2 = { version = "0.2", features = ["nightly"] }
quote = '0.5'
proc-macro2 = { version = "0.3", features = ["nightly"] }
wasm-bindgen-shared = { path = "../shared", version = "0.1.0" }
syn = { version = '0.12', features = ['full'] }
syn = { version = '0.13', features = ['full'] }

View File

@ -518,7 +518,7 @@ impl Export {
}
None => shared::free_function_export_name(self.function.name.as_ref()),
};
syn::LitStr::new(&name, Span::def_site())
syn::LitStr::new(&name, Span::call_site())
}
}
@ -751,7 +751,7 @@ fn extract_first_ty_param(ty: Option<&Type>) -> Option<Option<Type>> {
}
fn term<'a>(cursor: syn::buffer::Cursor<'a>, name: &str) -> syn::synom::PResult<'a, ()> {
if let Some((_span, term, next)) = cursor.term() {
if let Some((term, next)) = cursor.term() {
if term.as_str() == name {
return Ok(((), next));
}

View File

@ -5,7 +5,7 @@ use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering};
use ast;
use quote::{ToTokens, Tokens};
use proc_macro2::{Span, Literal};
use proc_macro2::Literal;
use shared;
use syn;
@ -76,7 +76,7 @@ impl ToTokens for ast::Program {
let mut generated_static_value = Tokens::new();
let generated_static_length = self.literal(&mut generated_static_value);
(my_quote! {
(quote! {
#[allow(non_upper_case_globals)]
#[wasm_custom_section = "__wasm_bindgen_unstable"]
const #generated_static_name: [u8; #generated_static_length] =
@ -92,7 +92,7 @@ impl ToTokens for ast::Struct {
let c = shared::name_to_descriptor(name.as_ref());
let descriptor = Literal::byte_string(format!("{:4}", c).as_bytes());
let borrowed_descriptor = Literal::byte_string(format!("{:4}", c + 1).as_bytes());
(my_quote! {
(quote! {
impl ::wasm_bindgen::convert::WasmBoundary for #name {
type Abi = u32;
const DESCRIPTOR: ::wasm_bindgen::convert::Descriptor =
@ -176,8 +176,8 @@ impl ToTokens for ast::Export {
let mut offset = 0;
if self.method {
let class = self.class.unwrap();
args.push(my_quote! { me: *mut ::wasm_bindgen::__rt::WasmRefCell<#class> });
arg_conversions.push(my_quote! {
args.push(quote! { me: *mut ::wasm_bindgen::__rt::WasmRefCell<#class> });
arg_conversions.push(quote! {
::wasm_bindgen::__rt::assert_not_null(me);
let me = unsafe { &*me };
});
@ -189,10 +189,10 @@ impl ToTokens for ast::Export {
let ident = syn::Ident::from(format!("arg{}", i));
match *ty {
ast::Type::ByValue(ref t) => {
args.push(my_quote! {
args.push(quote! {
#ident: <#t as ::wasm_bindgen::convert::WasmBoundary>::Abi
});
arg_conversions.push(my_quote! {
arg_conversions.push(quote! {
let #ident = unsafe {
<#t as ::wasm_bindgen::convert::WasmBoundary>
::from_abi(#ident, &mut __stack)
@ -200,10 +200,10 @@ impl ToTokens for ast::Export {
});
}
ast::Type::ByRef(ref ty) => {
args.push(my_quote! {
args.push(quote! {
#ident: <#ty as ::wasm_bindgen::convert::FromRefWasmBoundary>::Abi
});
arg_conversions.push(my_quote! {
arg_conversions.push(quote! {
let #ident = unsafe {
<#ty as ::wasm_bindgen::convert::FromRefWasmBoundary>
::from_abi_ref(#ident, &mut __stack)
@ -212,10 +212,10 @@ impl ToTokens for ast::Export {
});
}
ast::Type::ByMutRef(ref ty) => {
args.push(my_quote! {
args.push(quote! {
#ident: <#ty as ::wasm_bindgen::convert::FromRefMutWasmBoundary>::Abi
});
arg_conversions.push(my_quote! {
arg_conversions.push(quote! {
let mut #ident = unsafe {
<#ty as ::wasm_bindgen::convert::FromRefMutWasmBoundary>
::from_abi_ref_mut(#ident, &mut __stack)
@ -224,16 +224,16 @@ impl ToTokens for ast::Export {
});
}
}
converted_arguments.push(my_quote! { #ident });
converted_arguments.push(quote! { #ident });
}
let ret_ty;
let convert_ret;
match self.function.ret {
Some(ast::Type::ByValue(ref t)) => {
ret_ty = my_quote! {
ret_ty = quote! {
-> <#t as ::wasm_bindgen::convert::WasmBoundary>::Abi
};
convert_ret = my_quote! {
convert_ret = quote! {
<#t as ::wasm_bindgen::convert::WasmBoundary>
::into_abi(#ret, &mut unsafe {
::wasm_bindgen::convert::GlobalStack::new()
@ -245,8 +245,8 @@ impl ToTokens for ast::Export {
panic!("can't return a borrowed ref");
}
None => {
ret_ty = my_quote!{};
convert_ret = my_quote!{};
ret_ty = quote!{};
convert_ret = quote!{};
}
}
@ -254,16 +254,16 @@ impl ToTokens for ast::Export {
let receiver = match self.class {
Some(_) if self.method => {
if self.mutable {
my_quote! { me.borrow_mut().#name }
quote! { me.borrow_mut().#name }
} else {
my_quote! { me.borrow().#name }
quote! { me.borrow().#name }
}
}
Some(class) => my_quote! { #class::#name },
None => my_quote!{ #name },
Some(class) => quote! { #class::#name },
None => quote!{ #name },
};
let tokens = my_quote! {
let tokens = quote! {
#[export_name = #export_name]
#[allow(non_snake_case)]
pub extern fn #generated_name(#(#args),*) #ret_ty {
@ -286,7 +286,7 @@ impl ToTokens for ast::ImportType {
fn to_tokens(&self, tokens: &mut Tokens) {
let vis = &self.vis;
let name = &self.name;
(my_quote! {
(quote! {
#[allow(bad_style)]
#vis struct #name {
obj: ::wasm_bindgen::JsValue,
@ -412,15 +412,15 @@ impl ToTokens for ast::ImportFunction {
match *ty {
ast::Type::ByValue(ref t) => {
abi_argument_names.push(name);
abi_arguments.push(my_quote! {
abi_arguments.push(quote! {
#name: <#t as ::wasm_bindgen::convert::WasmBoundary>::Abi
});
let var = if i == 0 && is_method {
my_quote! { self }
quote! { self }
} else {
quote! { #name }
};
arg_conversions.push(my_quote! {
arg_conversions.push(quote! {
let #name = <#t as ::wasm_bindgen::convert::WasmBoundary>
::into_abi(#var, &mut __stack);
});
@ -428,13 +428,13 @@ impl ToTokens for ast::ImportFunction {
ast::Type::ByMutRef(_) => panic!("urgh mut"),
ast::Type::ByRef(ref t) => {
abi_argument_names.push(name);
abi_arguments.push(my_quote! { #name: u32 });
abi_arguments.push(quote! { #name: u32 });
let var = if i == 0 && is_method {
my_quote! { self }
quote! { self }
} else {
quote! { #name }
};
arg_conversions.push(my_quote! {
arg_conversions.push(quote! {
let #name = <#t as ::wasm_bindgen::convert::ToRefWasmBoundary>
::to_abi_ref(#var, &mut __stack);
});
@ -445,10 +445,10 @@ impl ToTokens for ast::ImportFunction {
let mut convert_ret;
match self.function.ret {
Some(ast::Type::ByValue(ref t)) => {
abi_ret = my_quote! {
abi_ret = quote! {
<#t as ::wasm_bindgen::convert::WasmBoundary>::Abi
};
convert_ret = my_quote! {
convert_ret = quote! {
<#t as ::wasm_bindgen::convert::WasmBoundary>
::from_abi(
#ret_ident,
@ -459,19 +459,19 @@ impl ToTokens for ast::ImportFunction {
Some(ast::Type::ByRef(_))
| Some(ast::Type::ByMutRef(_)) => panic!("can't return a borrowed ref"),
None => {
abi_ret = my_quote! { () };
convert_ret = my_quote! { () };
abi_ret = quote! { () };
convert_ret = quote! { () };
}
}
let mut exceptional_ret = my_quote!{};
let mut exceptional_ret = quote!{};
let exn_data = if self.function.opts.catch() {
let exn_data = syn::Ident::from("exn_data");
let exn_data_ptr = syn::Ident::from("exn_data_ptr");
abi_argument_names.push(exn_data_ptr);
abi_arguments.push(my_quote! { #exn_data_ptr: *mut u32 });
convert_ret = my_quote! { Ok(#convert_ret) };
exceptional_ret = my_quote! {
abi_arguments.push(quote! { #exn_data_ptr: *mut u32 });
convert_ret = quote! { Ok(#convert_ret) };
exceptional_ret = quote! {
if #exn_data[0] == 1 {
return Err(
<
@ -480,7 +480,7 @@ impl ToTokens for ast::ImportFunction {
)
}
};
my_quote! {
quote! {
let mut #exn_data = [0; 2];
let #exn_data_ptr = #exn_data.as_mut_ptr();
}
@ -500,12 +500,12 @@ impl ToTokens for ast::ImportFunction {
.collect::<Vec<_>>();
let me = if is_method {
my_quote! { &self, }
quote! { &self, }
} else {
quote!()
};
let invocation = my_quote! {
let invocation = quote! {
#(#attrs)*
#[allow(bad_style)]
#vis extern #fn_token #rust_name(#me #(#arguments),*) #ret {
@ -554,7 +554,7 @@ impl ToTokens for ast::Enum {
}
}
});
(my_quote! {
(quote! {
impl #enum_name {
fn from_u32(#incoming_u32: u32) -> #enum_name {
#(#cast_clauses else)* {
@ -591,7 +591,7 @@ impl ToTokens for ast::ImportStatic {
let ty = &self.ty;
let shim_name = self.shim;
let vis = &self.vis;
(my_quote! {
(quote! {
#[allow(bad_style)]
#vis static #name: ::wasm_bindgen::JsStatic<#ty> = {
fn init() -> #ty {

View File

@ -8,10 +8,6 @@ extern crate syn;
extern crate wasm_bindgen_shared as shared;
macro_rules! my_quote {
($($t:tt)*) => (quote_spanned!(Span::call_site() => $($t)*))
}
pub mod ast;
mod codegen;
mod literal;

View File

@ -1,5 +1,4 @@
use ast;
use proc_macro2::Span;
use quote::{ToTokens, Tokens};
use shared;
use std::collections::BTreeSet;
@ -142,14 +141,14 @@ impl Literal for ast::Type {
fn literal(&self, a: &mut LiteralBuilder) {
match *self {
ast::Type::ByValue(ref t) => {
a.as_char(my_quote! {
a.as_char(quote! {
<#t as ::wasm_bindgen::convert::WasmBoundary>::DESCRIPTOR
});
}
ast::Type::ByRef(ref ty) | ast::Type::ByMutRef(ref ty) => {
// TODO: this assumes `ToRef*` and `FromRef*` use the same
// descriptor.
a.as_char(my_quote! {
a.as_char(quote! {
<#ty as ::wasm_bindgen::convert::FromRefWasmBoundary>::DESCRIPTOR
});
}

View File

@ -14,9 +14,9 @@ Definition of the `#[wasm_bindgen]` attribute, an internal dependency
proc-macro = true
[dependencies]
syn = { version = '0.12', features = ['full'] }
quote = '0.4'
proc-macro2 = { version = "0.2", features = ["nightly"] }
syn = { version = '0.13', features = ['full'] }
quote = '0.5'
proc-macro2 = { version = "0.3", features = ["nightly"] }
serde_json = "1"
wasm-bindgen-shared = { path = "../shared", version = "0.1.0" }
wasm-bindgen-backend = { path = "../backend", version = "0.1.0" }

View File

@ -210,6 +210,9 @@ impl Project {
// move files from the root into each test, it looks like this may be
// needed for webpack to work well when invoked concurrently.
fs::hard_link("package.json", root.join("package.json")).unwrap();
if !Path::new("yarn.lock").exists() {
panic!("\n\nfailed to find `yarn.lock`, have you run `yarn` yet?\n\n");
}
fs::hard_link("yarn.lock", root.join("yarn.lock")).unwrap();
let cwd = env::current_dir().unwrap();
symlink_dir(&cwd.join("node_modules"), &root.join("node_modules")).unwrap();