mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-18 15:31:25 +00: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:
@ -123,7 +123,7 @@ impl<'src> FirstPass<'src, ()> for weedle::DictionaryDefinition<'src> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !record.dictionaries.insert(self.identifier.0) {
|
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(())
|
Ok(())
|
||||||
@ -137,7 +137,7 @@ impl<'src> FirstPass<'src, ()> for weedle::EnumDefinition<'src> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !record.enums.insert(self.identifier.0) {
|
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(())
|
Ok(())
|
||||||
@ -336,11 +336,11 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::OperationInterfaceM
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.specials.len() > 1 {
|
if self.specials.len() > 1 {
|
||||||
warn!("Unsupported webidl operation {:?}", self);
|
warn!("Unsupported webidl operation: {:?}", self);
|
||||||
return Ok(())
|
return Ok(())
|
||||||
}
|
}
|
||||||
if let Some(StringifierOrStatic::Stringifier(_)) = self.modifier {
|
if let Some(StringifierOrStatic::Stringifier(_)) = self.modifier {
|
||||||
warn!("Unsupported webidl operation {:?}", self);
|
warn!("Unsupported webidl stringifier: {:?}", self);
|
||||||
return Ok(())
|
return Ok(())
|
||||||
}
|
}
|
||||||
let mut ids = vec![OperationId::Operation(self.identifier.map(|s| s.0))];
|
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() {
|
if self.stringifier.is_some() {
|
||||||
warn!("Unsupported webidl operation {:?}", self);
|
warn!("Unsupported webidl stringifier: {:?}", self);
|
||||||
return Ok(())
|
return Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
first_pass_operation(
|
first_pass_operation(
|
||||||
record,
|
record,
|
||||||
FirstPassOperationType::Mixin,
|
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() {
|
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(())
|
Ok(())
|
||||||
|
@ -290,7 +290,7 @@ impl<'a> ToIdlType<'a> for Identifier<'a> {
|
|||||||
} else if record.enums.contains(self.0) {
|
} else if record.enums.contains(self.0) {
|
||||||
Some(IdlType::Enum(self.0))
|
Some(IdlType::Enum(self.0))
|
||||||
} else {
|
} else {
|
||||||
warn!("unrecognized type {}", self.0);
|
warn!("Unrecognized type: {}", self.0);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,12 +188,19 @@ impl<'src> WebidlParse<'src, ()> for weedle::Definition<'src> {
|
|||||||
weedle::Definition::Namespace(namespace) => {
|
weedle::Definition::Namespace(namespace) => {
|
||||||
namespace.webidl_parse(program, first_pass, ())?
|
namespace.webidl_parse(program, first_pass, ())?
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
| weedle::Definition::Callback(..)
|
weedle::Definition::Callback(..) => {
|
||||||
| weedle::Definition::CallbackInterface(..)
|
warn!("Unsupported WebIDL Callback definition: {:?}", self)
|
||||||
| weedle::Definition::Dictionary(..)
|
}
|
||||||
| weedle::Definition::PartialDictionary(..) => {
|
weedle::Definition::CallbackInterface(..) => {
|
||||||
warn!("Unsupported WebIDL definition: {:?}", self)
|
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(())
|
Ok(())
|
||||||
@ -288,7 +295,7 @@ impl<'src> WebidlParse<'src, ()> for weedle::PartialInterfaceDefinition<'src> {
|
|||||||
.get(self.identifier.0)
|
.get(self.identifier.0)
|
||||||
.map(|interface_data| !interface_data.partial)
|
.map(|interface_data| !interface_data.partial)
|
||||||
.unwrap_or(true) {
|
.unwrap_or(true) {
|
||||||
warn!(
|
info!(
|
||||||
"Partial interface {} missing non-partial interface",
|
"Partial interface {} missing non-partial interface",
|
||||||
self.identifier.0
|
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)
|
iterable.webidl_parse(program, first_pass, self_name)
|
||||||
}
|
}
|
||||||
// TODO
|
// TODO
|
||||||
| Maplike(_)
|
Maplike(_) => {
|
||||||
| Stringifier(_)
|
warn!("Unsupported WebIDL Maplike interface member: {:?}", self);
|
||||||
| Setlike(_) => {
|
Ok(())
|
||||||
warn!("Unsupported WebIDL interface member: {:?}", self);
|
}
|
||||||
|
Stringifier(_) => {
|
||||||
|
warn!("Unsupported WebIDL Stringifier interface member: {:?}", self);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
Setlike(_) => {
|
||||||
|
warn!("Unsupported WebIDL Setlike interface member: {:?}", self);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -482,7 +495,7 @@ impl<'a, 'src> WebidlParse<'src, &'a str> for weedle::mixin::MixinMember<'src> {
|
|||||||
}
|
}
|
||||||
// TODO
|
// TODO
|
||||||
weedle::mixin::MixinMember::Stringifier(_) => {
|
weedle::mixin::MixinMember::Stringifier(_) => {
|
||||||
warn!("Unsupported WebIDL mixin member: {:?}", self);
|
warn!("Unsupported WebIDL stringifier mixin member: {:?}", self);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -551,7 +564,7 @@ fn member_attribute<'src>(
|
|||||||
|
|
||||||
let is_static = match modifier {
|
let is_static = match modifier {
|
||||||
Some(Stringifier(_)) => {
|
Some(Stringifier(_)) => {
|
||||||
warn!("Unsupported stringifier on type {:?}", (self_name, identifier));
|
warn!("Unsupported stringifier on type: {:?}", (self_name, identifier));
|
||||||
return Ok(())
|
return Ok(())
|
||||||
}
|
}
|
||||||
Some(Inherit(_)) => false,
|
Some(Inherit(_)) => false,
|
||||||
@ -560,7 +573,7 @@ fn member_attribute<'src>(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if type_.attributes.is_some() {
|
if type_.attributes.is_some() {
|
||||||
warn!("Unsupported attributes on type {:?}", (self_name, identifier));
|
warn!("Unsupported attributes on type: {:?}", (self_name, identifier));
|
||||||
return Ok(())
|
return Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -656,7 +669,7 @@ fn member_operation<'src>(
|
|||||||
|
|
||||||
let is_static = match modifier {
|
let is_static = match modifier {
|
||||||
Some(Stringifier(_)) => {
|
Some(Stringifier(_)) => {
|
||||||
warn!("Unsupported stringifier on type {:?}", (self_name, identifier));
|
warn!("Unsupported stringifier on type: {:?}", (self_name, identifier));
|
||||||
return Ok(())
|
return Ok(())
|
||||||
}
|
}
|
||||||
Some(Static(_)) => true,
|
Some(Static(_)) => true,
|
||||||
@ -668,7 +681,7 @@ fn member_operation<'src>(
|
|||||||
];
|
];
|
||||||
if specials.len() > 1 {
|
if specials.len() > 1 {
|
||||||
warn!(
|
warn!(
|
||||||
"Unsupported specials ({:?}) on type {:?}",
|
"Unsupported specials: ({:?}) on type {:?}",
|
||||||
specials,
|
specials,
|
||||||
(self_name, identifier),
|
(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) => {
|
weedle::namespace::NamespaceMember::Operation(op) => {
|
||||||
op.webidl_parse(program, first_pass, (self_name, module))?;
|
op.webidl_parse(program, first_pass, (self_name, module))?;
|
||||||
}
|
}
|
||||||
weedle::namespace::NamespaceMember::Attribute(_) => {
|
weedle::namespace::NamespaceMember::Attribute(attr) => {
|
||||||
warn!("Attribute namespace members are not supported")
|
warn!("Unsupported attribute namespace member: {:?}", attr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -236,7 +236,7 @@ impl<'src> FirstPassRecord<'src> {
|
|||||||
match ret.to_syn_type(TypePosition::Return) {
|
match ret.to_syn_type(TypePosition::Return) {
|
||||||
None => {
|
None => {
|
||||||
warn!(
|
warn!(
|
||||||
"Cannot convert return type to syn type: {:?} on {:?}",
|
"Unsupported return type: {:?} on {:?}",
|
||||||
ret,
|
ret,
|
||||||
rust_name
|
rust_name
|
||||||
);
|
);
|
||||||
@ -320,7 +320,7 @@ impl<'src> FirstPassRecord<'src> {
|
|||||||
syn_type
|
syn_type
|
||||||
} else {
|
} else {
|
||||||
warn!(
|
warn!(
|
||||||
"Cannot convert argument type to syn type: {:?} on {:?}",
|
"Unsupported argument type: {:?} on {:?}",
|
||||||
idl_type,
|
idl_type,
|
||||||
rust_name
|
rust_name
|
||||||
);
|
);
|
||||||
@ -397,7 +397,7 @@ impl<'src> FirstPassRecord<'src> {
|
|||||||
first_pass::OperationId::Constructor => panic!("constructors are unsupported"),
|
first_pass::OperationId::Constructor => panic!("constructors are unsupported"),
|
||||||
first_pass::OperationId::Operation(name) => match name {
|
first_pass::OperationId::Operation(name) => match name {
|
||||||
None => {
|
None => {
|
||||||
warn!("Operations without a name are unsupported");
|
warn!("Unsupported unnamed operation: {:?}", operation_id);
|
||||||
return Vec::new();
|
return Vec::new();
|
||||||
}
|
}
|
||||||
Some(name) => name,
|
Some(name) => name,
|
||||||
@ -541,7 +541,7 @@ impl<'src> FirstPassRecord<'src> {
|
|||||||
let name = match operation_name {
|
let name = match operation_name {
|
||||||
Some(name) => name.to_string(),
|
Some(name) => name.to_string(),
|
||||||
None => {
|
None => {
|
||||||
warn!("Operations without a name are unsupported");
|
warn!("Unsupported unnamed operation: on {:?}", self_name);
|
||||||
return Vec::new();
|
return Vec::new();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user