Implement the gzip checksum

Also fix a bug in ast.Raw.SetPackage, discovered because type checking
failed to show that "[] u8" and "[] u8" are equivalent types.
This commit is contained in:
Nigel Tao committed 2018-03-28 12:30:00 +11:00
1 parent 153d1276a1
commit a8e40fedc9
7 files changed
+184 -28

No files matched your search

+6 -2
View File
@@ -324,8 +324,12 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
return nil
}
if isThatMethod(g.tm, n, g.tm.ByName("update").Key(), 1) {
// TODO: don't hard-code this.checksum.
b.printf("%sadler32__update(&self->private_impl.f_checksum, ", g.pkgPrefix)
// TODO: don't hard-code the class name or this.checksum.
class := "wuffs_crc32__ieee"
if g.pkgName == "zlib" {
class = "wuffs_zlib__adler32"
}
b.printf("%s__update(&self->private_impl.f_checksum, ", class)
a := n.Args()[0].Arg().Value()
if err := g.writeExpr(b, a, rp, parenthesesMandatory, depth); err != nil {
return err