Unverified Commit 6a417032 authored by Eric Myhre's avatar Eric Myhre Committed by GitHub

Merge pull request #91 from ipld/codegen-link-support-target-prototype-detection

Codegen for links should emit the methods to conform to the schema.TypedLinkNode interface where applicable.
parents f9787456 6de19b15
......@@ -48,6 +48,15 @@ func (g linkGenerator) EmitTypedNodeMethodType(w io.Writer) {
return nil /*TODO:typelit*/
}
`, w, g.AdjCfg, g)
// Bonus feature for some links (conforms to the schema.TypedLinkNode interface):
if g.Type.HasReferencedType() {
doTemplate(`
func ({{ .Type | TypeSymbol }}) LinkTargetNodePrototype() ipld.NodePrototype {
return Type.{{ .Type | TypeSymbol }}__Repr
}
`, w, g.AdjCfg, g)
}
}
func (g linkGenerator) EmitTypedNodeMethodRepresentation(w io.Writer) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment