Files
dolt/codegen/value.go
2015-06-12 15:22:27 -07:00

27 lines
481 B
Go

package gen
import (
"github.com/clipperhouse/typewriter"
)
func init() {
templates = append(templates, &typewriter.Template{
Name: "value",
Text: `
func (self {{.Name}}) Equals(other Value) bool {
if other, ok := other.({{.Name}}); ok {
return self == other
} else {
return false
}
}
func (v {{.Name}}) Ref() ref.Ref {
Chk.NotNil(Reffer, "Somebody forgot to call SetReffer")
return Reffer(v)
}
`,
TypeConstraint: typewriter.Constraint{Comparable: true},
})
}