Implement a polyfill attribute for imports

Allow using imported APIs under alternative names, such as prefixed
names, for web APIs when the exact API differs across browsers.
This commit is contained in:
Alex Crichton
2018-09-28 13:17:37 -07:00
parent 11bcaf42d5
commit 3c14f7a6eb
11 changed files with 172 additions and 2 deletions

View File

@ -144,6 +144,7 @@ pub struct ImportType {
pub doc_comment: Option<String>,
pub instanceof_shim: String,
pub extends: Vec<Ident>,
pub polyfills: Vec<Ident>,
}
#[cfg_attr(feature = "extra-traits", derive(Debug, PartialEq, Eq))]
@ -478,6 +479,7 @@ impl ImportType {
shared::ImportType {
name: self.js_name.clone(),
instanceof_shim: self.instanceof_shim.clone(),
polyfills: self.polyfills.iter().map(|s| s.to_string()).collect(),
}
}
}