diff --git a/generate/generate.go b/generate/generate.go index 3fd2a73..a22f6f5 100644 --- a/generate/generate.go +++ b/generate/generate.go @@ -610,23 +610,17 @@ func (this *Generator) generateDecodeBranch(hash [16]byte, typ Type) (n int, err n += nn; if err != nil { return n, err } return n, nil } - - // FIXME: the tag is validated improperly, the result of - // generateTag means basically nothing here because - // there is no data in the destination, we need another - // function that checks if a tag can be assigned to a - // PDL type // validate header // TODO: here, validate that length is less than the // max, whatever that is configured to be. the reason we // want to read it here is that we would have to skip // the tag anyway so why not. - nn, err = this.iprintf("if %s != ", elementTagVar) + nn, err = this.iprintf("if !(") n += nn; if err != nil { return n, err } - nn, err = this.generateTag(typ.Element, "(*this)") + nn, err = this.generateCanAssign(typ.Element, elementTagVar) n += nn; if err != nil { return n, err } - nn, err = this.printf(" {\n") + nn, err = this.printf(") {\n") n += nn; if err != nil { return n, err } this.push() nn, err = abort()