clean up the code, flow errors out to decoder.

R=rsc
DELTA=99  (32 added, 22 deleted, 45 changed)
OCL=31759
CL=31759
This commit is contained in:
Rob Pike 2009-07-16 23:01:10 -07:00
parent 1737157189
commit be2cf952a8
4 changed files with 71 additions and 61 deletions

View file

@ -372,7 +372,7 @@ func encOpFor(rt reflect.Type) (encOp, int) {
}
}
if op == nil {
panicln("encode can't handle type", rt.String());
panicln("can't happen: encode type", rt.String());
}
return op, indir
}
@ -381,7 +381,7 @@ func encOpFor(rt reflect.Type) (encOp, int) {
func compileEnc(rt reflect.Type) *encEngine {
srt, ok := rt.(*reflect.StructType);
if !ok {
panicln("TODO: can't handle non-structs");
panicln("can't happen: non-struct");
}
engine := new(encEngine);
engine.instr = make([]encInstr, srt.NumField()+1); // +1 for terminator