Upgrade weedle to v0.11 (#2024)

This commit is contained in:
Nikhil Benesch 2020-03-02 16:31:02 -05:00 committed by GitHub
parent 381660c49b
commit eb04cf2dda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 19 deletions

View File

@ -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"

View File

@ -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(())

View File

@ -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.