mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-15 09:40:52 +00:00
Upgrade weedle to v0.11 (#2024)
This commit is contained in:
parent
381660c49b
commit
eb04cf2dda
@ -20,4 +20,4 @@ proc-macro2 = "1.0"
|
||||
quote = '1.0'
|
||||
syn = { version = '1.0', features = ['full'] }
|
||||
wasm-bindgen-backend = { version = "=0.2.58", path = "../backend" }
|
||||
weedle = "0.10"
|
||||
weedle = "0.11"
|
||||
|
@ -475,6 +475,13 @@ impl<'src> FirstPass<'src, (&'src str, ApiStability)> for weedle::interface::Int
|
||||
.push(const_);
|
||||
Ok(())
|
||||
}
|
||||
InterfaceMember::Constructor(_) => {
|
||||
log::warn!(
|
||||
"Unsupported WebIDL Constructor interface member: {:?}",
|
||||
self
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
InterfaceMember::Iterable(_iterable) => {
|
||||
log::warn!("Unsupported WebIDL iterable interface member: {:?}", self);
|
||||
Ok(())
|
||||
|
@ -37,6 +37,7 @@ use wasm_bindgen_backend::TryToTokens;
|
||||
use weedle::attribute::ExtendedAttributeList;
|
||||
use weedle::dictionary::DictionaryMember;
|
||||
use weedle::interface::InterfaceMember;
|
||||
use weedle::Parse;
|
||||
|
||||
struct Program {
|
||||
main: ast::Program,
|
||||
@ -74,26 +75,19 @@ impl Default for ApiStability {
|
||||
}
|
||||
|
||||
fn parse_source(source: &str) -> Result<Vec<weedle::Definition>> {
|
||||
weedle::parse(source).map_err(|e| {
|
||||
match &e {
|
||||
weedle::Err::Incomplete(needed) => anyhow::anyhow!("needed {:?} more bytes", needed),
|
||||
weedle::Err::Error(cx) | weedle::Err::Failure(cx) => {
|
||||
// Note that #[allow] here is a workaround for Geal/nom#843
|
||||
// because the `Context` type here comes from `nom` and if
|
||||
// something else in our crate graph enables the
|
||||
// `verbose-errors` feature then we need to still compiled
|
||||
// against the changed enum definition.
|
||||
#[allow(unreachable_patterns)]
|
||||
let remaining = match cx {
|
||||
weedle::Context::Code(remaining, _) => remaining.len(),
|
||||
_ => 0,
|
||||
};
|
||||
let pos = source.len() - remaining;
|
||||
match weedle::Definitions::parse(source) {
|
||||
Ok(("", parsed)) => Ok(parsed),
|
||||
|
||||
WebIDLParseError(pos).into()
|
||||
}
|
||||
Ok((remaining, _))
|
||||
| Err(weedle::Err::Error((remaining, _)))
|
||||
| Err(weedle::Err::Failure((remaining, _))) => {
|
||||
Err(WebIDLParseError(source.len() - remaining.len()).into())
|
||||
}
|
||||
})
|
||||
|
||||
Err(weedle::Err::Incomplete(needed)) => {
|
||||
Err(anyhow::anyhow!("needed {:?} more bytes", needed))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a string of WebIDL source text into a wasm-bindgen AST.
|
||||
|
Loading…
x
Reference in New Issue
Block a user