json bugfixes
This commit is contained in:
parent
765961438d
commit
fe82374328
@ -122,24 +122,21 @@ pub impl Encoder: serialize::Encoder {
|
||||
fn emit_managed(&self, f: fn()) { f() }
|
||||
|
||||
fn emit_enum(&self, name: &str, f: fn()) {
|
||||
f()
|
||||
}
|
||||
|
||||
fn emit_enum_variant(&self, _name: &str, id: uint, _cnt: uint, f: fn()) {
|
||||
// emitting enums as arrays where the first
|
||||
// element provides the enum variant name
|
||||
self.wr.write_char('[');
|
||||
self.wr.write_str(name);
|
||||
self.wr.write_str(escape_str(_name));
|
||||
self.wr.write_char(',');
|
||||
f();
|
||||
self.wr.write_char(']');
|
||||
}
|
||||
|
||||
fn emit_enum_variant(&self, _name: &str, id: uint, _cnt: uint, f: fn()) {
|
||||
if id == 0 {
|
||||
self.emit_nil();
|
||||
} else {
|
||||
f()
|
||||
}
|
||||
}
|
||||
fn emit_enum_variant_arg(&self, _idx: uint, f: fn()) {
|
||||
f()
|
||||
if _idx != 0 {self.wr.write_char(',');}
|
||||
f();
|
||||
}
|
||||
|
||||
fn emit_borrowed_vec(&self, _len: uint, f: fn()) {
|
||||
|
Loading…
Reference in New Issue
Block a user