mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-09 21:56:05 +00:00
Fix chrome only checks
This commit is contained in:
parent
5ae18d18e9
commit
ce2c0ded74
@ -105,15 +105,24 @@ impl<'src> FirstPass<'src, ()> for weedle::Definition<'src> {
|
|||||||
|
|
||||||
impl<'src> FirstPass<'src, ()> for weedle::DictionaryDefinition<'src> {
|
impl<'src> FirstPass<'src, ()> for weedle::DictionaryDefinition<'src> {
|
||||||
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> {
|
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> {
|
||||||
|
if util::is_chrome_only(&self.attributes) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
if !record.dictionaries.insert(self.identifier.0) {
|
if !record.dictionaries.insert(self.identifier.0) {
|
||||||
warn!("encountered multiple dictionary declarations of {}", self.identifier.0);
|
warn!("encountered multiple dictionary declarations of {}", self.identifier.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'src> FirstPass<'src, ()> for weedle::EnumDefinition<'src> {
|
impl<'src> FirstPass<'src, ()> for weedle::EnumDefinition<'src> {
|
||||||
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> {
|
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> {
|
||||||
|
if util::is_chrome_only(&self.attributes) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
if !record.enums.insert(self.identifier.0) {
|
if !record.enums.insert(self.identifier.0) {
|
||||||
warn!("Encountered multiple enum declarations of {}", self.identifier.0);
|
warn!("Encountered multiple enum declarations of {}", self.identifier.0);
|
||||||
}
|
}
|
||||||
@ -124,11 +133,16 @@ impl<'src> FirstPass<'src, ()> for weedle::EnumDefinition<'src> {
|
|||||||
|
|
||||||
impl<'src> FirstPass<'src, ()> for weedle::IncludesStatementDefinition<'src> {
|
impl<'src> FirstPass<'src, ()> for weedle::IncludesStatementDefinition<'src> {
|
||||||
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> {
|
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> {
|
||||||
|
if util::is_chrome_only(&self.attributes) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
record
|
record
|
||||||
.includes
|
.includes
|
||||||
.entry(self.lhs_identifier.0)
|
.entry(self.lhs_identifier.0)
|
||||||
.or_insert_with(Default::default)
|
.or_insert_with(Default::default)
|
||||||
.insert(self.rhs_identifier.0);
|
.insert(self.rhs_identifier.0);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,6 +187,10 @@ fn first_pass_operation<'src>(
|
|||||||
|
|
||||||
impl<'src> FirstPass<'src, ()> for weedle::InterfaceDefinition<'src> {
|
impl<'src> FirstPass<'src, ()> for weedle::InterfaceDefinition<'src> {
|
||||||
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> {
|
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> {
|
||||||
|
if util::is_chrome_only(&self.attributes) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
let interface_data = record
|
let interface_data = record
|
||||||
.interfaces
|
.interfaces
|
||||||
@ -182,10 +200,6 @@ impl<'src> FirstPass<'src, ()> for weedle::InterfaceDefinition<'src> {
|
|||||||
interface_data.superclass = self.inheritance.map(|s| s.identifier.0);
|
interface_data.superclass = self.inheritance.map(|s| s.identifier.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if util::is_chrome_only(&self.attributes) {
|
|
||||||
return Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(attrs) = &self.attributes {
|
if let Some(attrs) = &self.attributes {
|
||||||
for attr in &attrs.body.list {
|
for attr in &attrs.body.list {
|
||||||
attr.first_pass(record, self.identifier.0)?;
|
attr.first_pass(record, self.identifier.0)?;
|
||||||
@ -202,6 +216,10 @@ impl<'src> FirstPass<'src, ()> for weedle::InterfaceDefinition<'src> {
|
|||||||
|
|
||||||
impl<'src> FirstPass<'src, ()> for weedle::PartialInterfaceDefinition<'src> {
|
impl<'src> FirstPass<'src, ()> for weedle::PartialInterfaceDefinition<'src> {
|
||||||
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> {
|
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> {
|
||||||
|
if util::is_chrome_only(&self.attributes) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
record
|
record
|
||||||
.interfaces
|
.interfaces
|
||||||
.entry(self.identifier.0)
|
.entry(self.identifier.0)
|
||||||
@ -214,10 +232,6 @@ impl<'src> FirstPass<'src, ()> for weedle::PartialInterfaceDefinition<'src> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if util::is_chrome_only(&self.attributes) {
|
|
||||||
return Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
for member in &self.members.body {
|
for member in &self.members.body {
|
||||||
member.first_pass(record, self.identifier.0)?;
|
member.first_pass(record, self.identifier.0)?;
|
||||||
}
|
}
|
||||||
@ -284,6 +298,10 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::InterfaceMember<'sr
|
|||||||
|
|
||||||
impl<'src> FirstPass<'src, &'src str> for weedle::interface::OperationInterfaceMember<'src> {
|
impl<'src> FirstPass<'src, &'src str> for weedle::interface::OperationInterfaceMember<'src> {
|
||||||
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, self_name: &'src str) -> Result<()> {
|
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, self_name: &'src str) -> Result<()> {
|
||||||
|
if util::is_chrome_only(&self.attributes) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
if !self.specials.is_empty() && self.specials.len() != 1 {
|
if !self.specials.is_empty() && self.specials.len() != 1 {
|
||||||
warn!("Unsupported webidl operation {:?}", self);
|
warn!("Unsupported webidl operation {:?}", self);
|
||||||
return Ok(())
|
return Ok(())
|
||||||
@ -313,6 +331,10 @@ impl<'src> FirstPass<'src, &'src str> for weedle::interface::OperationInterfaceM
|
|||||||
|
|
||||||
impl<'src> FirstPass<'src, ()> for weedle::InterfaceMixinDefinition<'src>{
|
impl<'src> FirstPass<'src, ()> for weedle::InterfaceMixinDefinition<'src>{
|
||||||
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> {
|
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> {
|
||||||
|
if util::is_chrome_only(&self.attributes) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
let mixin_data = record
|
let mixin_data = record
|
||||||
.mixins
|
.mixins
|
||||||
@ -322,10 +344,6 @@ impl<'src> FirstPass<'src, ()> for weedle::InterfaceMixinDefinition<'src>{
|
|||||||
mixin_data.members.push(&self.members.body);
|
mixin_data.members.push(&self.members.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
if util::is_chrome_only(&self.attributes) {
|
|
||||||
return Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
for member in &self.members.body {
|
for member in &self.members.body {
|
||||||
member.first_pass(record, self.identifier.0)?;
|
member.first_pass(record, self.identifier.0)?;
|
||||||
}
|
}
|
||||||
@ -336,6 +354,10 @@ impl<'src> FirstPass<'src, ()> for weedle::InterfaceMixinDefinition<'src>{
|
|||||||
|
|
||||||
impl<'src> FirstPass<'src, ()> for weedle::PartialInterfaceMixinDefinition<'src> {
|
impl<'src> FirstPass<'src, ()> for weedle::PartialInterfaceMixinDefinition<'src> {
|
||||||
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> {
|
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, (): ()) -> Result<()> {
|
||||||
|
if util::is_chrome_only(&self.attributes) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
record
|
record
|
||||||
.mixins
|
.mixins
|
||||||
.entry(self.identifier.0)
|
.entry(self.identifier.0)
|
||||||
@ -349,10 +371,6 @@ impl<'src> FirstPass<'src, ()> for weedle::PartialInterfaceMixinDefinition<'src>
|
|||||||
.members
|
.members
|
||||||
.push(&self.members.body);
|
.push(&self.members.body);
|
||||||
|
|
||||||
if util::is_chrome_only(&self.attributes) {
|
|
||||||
return Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
for member in &self.members.body {
|
for member in &self.members.body {
|
||||||
member.first_pass(record, self.identifier.0)?;
|
member.first_pass(record, self.identifier.0)?;
|
||||||
}
|
}
|
||||||
@ -374,6 +392,10 @@ impl<'src> FirstPass<'src, &'src str> for weedle::mixin::MixinMember<'src> {
|
|||||||
|
|
||||||
impl<'src> FirstPass<'src, &'src str> for weedle::mixin::OperationMixinMember<'src> {
|
impl<'src> FirstPass<'src, &'src str> for weedle::mixin::OperationMixinMember<'src> {
|
||||||
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, self_name: &'src str) -> Result<()> {
|
fn first_pass(&'src self, record: &mut FirstPassRecord<'src>, self_name: &'src str) -> Result<()> {
|
||||||
|
if util::is_chrome_only(&self.attributes) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
if self.stringifier.is_some() {
|
if self.stringifier.is_some() {
|
||||||
warn!("Unsupported webidl operation {:?}", self);
|
warn!("Unsupported webidl operation {:?}", self);
|
||||||
return Ok(())
|
return Ok(())
|
||||||
|
@ -659,6 +659,7 @@ fn member_operation<'src>(
|
|||||||
if util::is_chrome_only(attrs) {
|
if util::is_chrome_only(attrs) {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
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));
|
||||||
@ -754,6 +755,10 @@ impl<'src> WebidlParse<'src, ()> for weedle::EnumDefinition<'src> {
|
|||||||
_: &FirstPassRecord<'src>,
|
_: &FirstPassRecord<'src>,
|
||||||
(): (),
|
(): (),
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
if util::is_chrome_only(&self.attributes) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let variants = &self.values.body.list;
|
let variants = &self.values.body.list;
|
||||||
program.imports.push(backend::ast::Import {
|
program.imports.push(backend::ast::Import {
|
||||||
module: None,
|
module: None,
|
||||||
@ -787,6 +792,10 @@ impl<'src> WebidlParse<'src, &'src str> for weedle::interface::ConstMember<'src>
|
|||||||
record: &FirstPassRecord<'src>,
|
record: &FirstPassRecord<'src>,
|
||||||
self_name: &'src str,
|
self_name: &'src str,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
if util::is_chrome_only(&self.attributes) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let ty = match self.const_type.to_syn_type(record, TypePosition::Return) {
|
let ty = match self.const_type.to_syn_type(record, TypePosition::Return) {
|
||||||
Some(s) => s,
|
Some(s) => s,
|
||||||
None => return Ok(()),
|
None => return Ok(()),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user