Implement support for js_class on exported types

Allow defining types which have different names in Rust than they have
in JS! (just like can be done with imported types)

Closes #1010
This commit is contained in:
Alex Crichton
2018-11-05 12:29:14 -08:00
parent 3c31a32d51
commit 16d5243362
8 changed files with 142 additions and 31 deletions

View File

@ -58,7 +58,7 @@ fn shared_export<'a>(export: &'a ast::Export, intern: &'a Interner) -> Export<'a
None => (false, false),
};
Export {
class: export.class.as_ref().map(|s| intern.intern(s)),
class: export.js_class.as_ref().map(|s| &**s),
method,
consumed,
is_constructor: export.is_constructor,
@ -187,7 +187,7 @@ fn shared_import_enum<'a>(_i: &'a ast::ImportEnum, _intern: &'a Interner)
fn shared_struct<'a>(s: &'a ast::Struct, intern: &'a Interner) -> Struct<'a> {
Struct {
name: intern.intern(&s.name),
name: &s.js_name,
fields: s.fields.iter().map(|s| shared_struct_field(s, intern)).collect(),
comments: s.comments.iter().map(|s| &**s).collect(),
}