mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-27 20:15:14 +03:00
webidl: Make logging a little more consistently formatted
This commit makes these changes: * Unsupported constructs always log "unsupported" for easy `grep`ing * There is always a "<generic message> : <details>" format now, so we can easily use `cut` to grab the generic message and count which kinds of things are our biggest missing features. * Make sure that we have different `warn!` logs for each kind of unsupported thing, instead of grouping them together. Put all that together and this is the current state of `wasm-bindgen-webidl` and `web-sys`: ``` $ grep WARN stderr.txt | grep wasm_bindgen_webidl | grep -i unsupported | cut -d ' ' -f5- | cut -d ':' -f 1 | sort | uniq -c | sort -rn 387 Unsupported WebIDL Dictionary definition 139 Unsupported argument type 70 Unsupported return type 47 Unsupported WebIDL Callback definition 22 Unsupported WebIDL extended attribute 18 Unsupported unnamed operation 9 Unsupported WebIDL CallbackInterface definition 7 Unsupported WebIDL Stringifier interface member 7 Unsupported WebIDL Maplike interface member 2 Unsupported webidl stringifier 2 Unsupported WebIDL Setlike interface member 2 Unsupported stringifier on type ```
This commit is contained in:
parent
c1f7b42662
commit
21063fd42f
@ -123,7 +123,7 @@ impl<'src> FirstPass<'src, ()> for weedle::DictionaryDefinition<'src> {
|
||||
}
|
||||
|
||||
if !record.dictionaries.insert(self.identifier.0) {
|
||||
warn!("encountered multiple dictionary declarations of {}", self.identifier.0);
|
||||
info!("Encountered multiple dictionary declarations: {}", self.identifier.0);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@ -137,7 +137,7 @@ impl<'src> FirstPass<'src, ()> for weedle::EnumDefinition<'src> {
|
||||
}
|
||||
|
||||
if !record.enums.insert(self.identifier.0) {
|
||||
warn!("Encountered multiple enum declarations of {}", self.identifier.0);
|
||||
info!("Encountered multiple enum declarations: {}", self.identifier.0);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@ -336,11 +336,11 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::OperationInterfaceM
|
||||
}
|
||||
|
||||
if self.specials.len() > 1 {
|
||||
warn!("Unsupported webidl operation {:?}", self);
|
||||
warn!("Unsupported webidl operation: {:?}", self);
|
||||
return Ok(())
|
||||
}
|
||||
if let Some(StringifierOrStatic::Stringifier(_)) = self.modifier {
|
||||
warn!("Unsupported webidl operation {:?}", self);
|
||||
warn!("Unsupported webidl stringifier: {:?}", self);
|
||||
return Ok(())
|
||||
}
|
||||
let mut ids = vec![OperationId::Operation(self.identifier.map(|s| s.0))];
|
||||
@ -430,9 +430,10 @@ impl<'src> FirstPass<'src, &'src str> for weedle::mixin::OperationMixinMember<'s
|
||||
}
|
||||
|
||||
if self.stringifier.is_some() {
|
||||
warn!("Unsupported webidl operation {:?}", self);
|
||||
warn!("Unsupported webidl stringifier: {:?}", self);
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
first_pass_operation(
|
||||
record,
|
||||
FirstPassOperationType::Mixin,
|
||||
@ -450,7 +451,7 @@ impl<'src> FirstPass<'src, ()> for weedle::TypedefDefinition<'src> {
|
||||
}
|
||||
|
||||
if record.typedefs.insert(self.identifier.0, &self.type_.type_).is_some() {
|
||||
warn!("Encountered multiple declarations of {}", self.identifier.0);
|
||||
info!("Encountered multiple typedef declarations: {}", self.identifier.0);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -290,7 +290,7 @@ impl<'a> ToIdlType<'a> for Identifier<'a> {
|
||||
} else if record.enums.contains(self.0) {
|
||||
Some(IdlType::Enum(self.0))
|
||||
} else {
|
||||
warn!("unrecognized type {}", self.0);
|
||||
warn!("Unrecognized type: {}", self.0);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
@ -188,12 +188,19 @@ impl<'src> WebidlParse<'src, ()> for weedle::Definition<'src> {
|
||||
weedle::Definition::Namespace(namespace) => {
|
||||
namespace.webidl_parse(program, first_pass, ())?
|
||||
}
|
||||
|
||||
// TODO
|
||||
| weedle::Definition::Callback(..)
|
||||
| weedle::Definition::CallbackInterface(..)
|
||||
| weedle::Definition::Dictionary(..)
|
||||
| weedle::Definition::PartialDictionary(..) => {
|
||||
warn!("Unsupported WebIDL definition: {:?}", self)
|
||||
weedle::Definition::Callback(..) => {
|
||||
warn!("Unsupported WebIDL Callback definition: {:?}", self)
|
||||
}
|
||||
weedle::Definition::CallbackInterface(..) => {
|
||||
warn!("Unsupported WebIDL CallbackInterface definition: {:?}", self)
|
||||
}
|
||||
weedle::Definition::Dictionary(..) => {
|
||||
warn!("Unsupported WebIDL Dictionary definition: {:?}", self)
|
||||
}
|
||||
weedle::Definition::PartialDictionary(..) => {
|
||||
warn!("Unsupported WebIDL PartialDictionary definition: {:?}", self)
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@ -288,7 +295,7 @@ impl<'src> WebidlParse<'src, ()> for weedle::PartialInterfaceDefinition<'src> {
|
||||
.get(self.identifier.0)
|
||||
.map(|interface_data| !interface_data.partial)
|
||||
.unwrap_or(true) {
|
||||
warn!(
|
||||
info!(
|
||||
"Partial interface {} missing non-partial interface",
|
||||
self.identifier.0
|
||||
);
|
||||
@ -453,10 +460,16 @@ impl<'src> WebidlParse<'src, &'src str> for weedle::interface::InterfaceMember<'
|
||||
iterable.webidl_parse(program, first_pass, self_name)
|
||||
}
|
||||
// TODO
|
||||
| Maplike(_)
|
||||
| Stringifier(_)
|
||||
| Setlike(_) => {
|
||||
warn!("Unsupported WebIDL interface member: {:?}", self);
|
||||
Maplike(_) => {
|
||||
warn!("Unsupported WebIDL Maplike interface member: {:?}", self);
|
||||
Ok(())
|
||||
}
|
||||
Stringifier(_) => {
|
||||
warn!("Unsupported WebIDL Stringifier interface member: {:?}", self);
|
||||
Ok(())
|
||||
}
|
||||
Setlike(_) => {
|
||||
warn!("Unsupported WebIDL Setlike interface member: {:?}", self);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@ -482,7 +495,7 @@ impl<'a, 'src> WebidlParse<'src, &'a str> for weedle::mixin::MixinMember<'src> {
|
||||
}
|
||||
// TODO
|
||||
weedle::mixin::MixinMember::Stringifier(_) => {
|
||||
warn!("Unsupported WebIDL mixin member: {:?}", self);
|
||||
warn!("Unsupported WebIDL stringifier mixin member: {:?}", self);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@ -551,7 +564,7 @@ fn member_attribute<'src>(
|
||||
|
||||
let is_static = match modifier {
|
||||
Some(Stringifier(_)) => {
|
||||
warn!("Unsupported stringifier on type {:?}", (self_name, identifier));
|
||||
warn!("Unsupported stringifier on type: {:?}", (self_name, identifier));
|
||||
return Ok(())
|
||||
}
|
||||
Some(Inherit(_)) => false,
|
||||
@ -560,7 +573,7 @@ fn member_attribute<'src>(
|
||||
};
|
||||
|
||||
if type_.attributes.is_some() {
|
||||
warn!("Unsupported attributes on type {:?}", (self_name, identifier));
|
||||
warn!("Unsupported attributes on type: {:?}", (self_name, identifier));
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
@ -656,7 +669,7 @@ fn member_operation<'src>(
|
||||
|
||||
let is_static = match modifier {
|
||||
Some(Stringifier(_)) => {
|
||||
warn!("Unsupported stringifier on type {:?}", (self_name, identifier));
|
||||
warn!("Unsupported stringifier on type: {:?}", (self_name, identifier));
|
||||
return Ok(())
|
||||
}
|
||||
Some(Static(_)) => true,
|
||||
@ -668,7 +681,7 @@ fn member_operation<'src>(
|
||||
];
|
||||
if specials.len() > 1 {
|
||||
warn!(
|
||||
"Unsupported specials ({:?}) on type {:?}",
|
||||
"Unsupported specials: ({:?}) on type {:?}",
|
||||
specials,
|
||||
(self_name, identifier),
|
||||
);
|
||||
@ -893,8 +906,8 @@ impl<'src> WebidlParse<'src, (&'src str, &'src mut backend::ast::Module)> for we
|
||||
weedle::namespace::NamespaceMember::Operation(op) => {
|
||||
op.webidl_parse(program, first_pass, (self_name, module))?;
|
||||
}
|
||||
weedle::namespace::NamespaceMember::Attribute(_) => {
|
||||
warn!("Attribute namespace members are not supported")
|
||||
weedle::namespace::NamespaceMember::Attribute(attr) => {
|
||||
warn!("Unsupported attribute namespace member: {:?}", attr)
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
@ -236,7 +236,7 @@ impl<'src> FirstPassRecord<'src> {
|
||||
match ret.to_syn_type(TypePosition::Return) {
|
||||
None => {
|
||||
warn!(
|
||||
"Cannot convert return type to syn type: {:?} on {:?}",
|
||||
"Unsupported return type: {:?} on {:?}",
|
||||
ret,
|
||||
rust_name
|
||||
);
|
||||
@ -320,7 +320,7 @@ impl<'src> FirstPassRecord<'src> {
|
||||
syn_type
|
||||
} else {
|
||||
warn!(
|
||||
"Cannot convert argument type to syn type: {:?} on {:?}",
|
||||
"Unsupported argument type: {:?} on {:?}",
|
||||
idl_type,
|
||||
rust_name
|
||||
);
|
||||
@ -397,7 +397,7 @@ impl<'src> FirstPassRecord<'src> {
|
||||
first_pass::OperationId::Constructor => panic!("constructors are unsupported"),
|
||||
first_pass::OperationId::Operation(name) => match name {
|
||||
None => {
|
||||
warn!("Operations without a name are unsupported");
|
||||
warn!("Unsupported unnamed operation: {:?}", operation_id);
|
||||
return Vec::new();
|
||||
}
|
||||
Some(name) => name,
|
||||
@ -541,7 +541,7 @@ impl<'src> FirstPassRecord<'src> {
|
||||
let name = match operation_name {
|
||||
Some(name) => name.to_string(),
|
||||
None => {
|
||||
warn!("Operations without a name are unsupported");
|
||||
warn!("Unsupported unnamed operation: on {:?}", self_name);
|
||||
return Vec::new();
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user