Allow inheritance between structs.
No subtyping, no interaction with traits. Partially addresses #9912.
This commit is contained in:
@@ -640,6 +640,9 @@ impl<'a> State<'a> {
|
||||
));
|
||||
}
|
||||
ast::ItemStruct(struct_def, ref generics) => {
|
||||
if struct_def.is_virtual {
|
||||
try!(self.word_space("virtual"));
|
||||
}
|
||||
try!(self.head(visibility_qualified(item.vis, "struct")));
|
||||
try!(self.print_struct(struct_def, generics, item.ident, item.span));
|
||||
}
|
||||
@@ -754,6 +757,13 @@ impl<'a> State<'a> {
|
||||
span: codemap::Span) -> IoResult<()> {
|
||||
try!(self.print_ident(ident));
|
||||
try!(self.print_generics(generics));
|
||||
match struct_def.super_struct {
|
||||
Some(t) => {
|
||||
try!(self.word_space(":"));
|
||||
try!(self.print_type(t));
|
||||
},
|
||||
None => {},
|
||||
}
|
||||
if ast_util::struct_def_is_tuple_like(struct_def) {
|
||||
if !struct_def.fields.is_empty() {
|
||||
try!(self.popen());
|
||||
|
||||
Reference in New Issue
Block a user