Commit 29c1b98e authored by Eric Myhre's avatar Eric Myhre

basicnode's constructors shall all prefix 'New'.

This first crossed my mind when considering whether it might be a good
idea to export the concrete implementation types of the 'basicnode'
package (see previous couple of commits -- it mostly had to do with the
question of whether we could reuse more code and shrink the size of
packages emitted by codegen)... but even though that's resolved to a
pretty solid "nope", it still makes sense to have a consistent name
prefix pattern here... and we'll probably encourage and expect to see
similar conventions in other packages (including in codegen, if we
add a handy-constructor-funcs feature to that).
parent 139d1eb6
......@@ -105,7 +105,7 @@ func (nb *anyBuilder) AssignBool(v bool) error {
panic("misuse")
}
nb.kind = ipld.ReprKind_Bool
nb.scalarNode = Bool(v)
nb.scalarNode = NewBool(v)
return nil
}
func (nb *anyBuilder) AssignInt(v int) error {
......@@ -113,7 +113,7 @@ func (nb *anyBuilder) AssignInt(v int) error {
panic("misuse")
}
nb.kind = ipld.ReprKind_Int
nb.scalarNode = Int(v)
nb.scalarNode = NewInt(v)
return nil
}
func (nb *anyBuilder) AssignFloat(v float64) error {
......@@ -121,7 +121,7 @@ func (nb *anyBuilder) AssignFloat(v float64) error {
panic("misuse")
}
nb.kind = ipld.ReprKind_Float
nb.scalarNode = Float(v)
nb.scalarNode = NewFloat(v)
return nil
}
func (nb *anyBuilder) AssignString(v string) error {
......@@ -129,7 +129,7 @@ func (nb *anyBuilder) AssignString(v string) error {
panic("misuse")
}
nb.kind = ipld.ReprKind_String
nb.scalarNode = String(v)
nb.scalarNode = NewString(v)
return nil
}
func (nb *anyBuilder) AssignBytes(v []byte) error {
......@@ -137,7 +137,7 @@ func (nb *anyBuilder) AssignBytes(v []byte) error {
panic("misuse")
}
nb.kind = ipld.ReprKind_Bytes
nb.scalarNode = Bytes(v)
nb.scalarNode = NewBytes(v)
return nil
}
func (nb *anyBuilder) AssignLink(v ipld.Link) error {
......@@ -145,7 +145,7 @@ func (nb *anyBuilder) AssignLink(v ipld.Link) error {
panic("misuse")
}
nb.kind = ipld.ReprKind_Link
nb.scalarNode = Link(v)
nb.scalarNode = NewLink(v)
return nil
}
func (nb *anyBuilder) AssignNode(v ipld.Node) error {
......
......@@ -12,7 +12,7 @@ var (
_ ipld.NodeAssembler = &plainBool__Assembler{}
)
func Bool(value bool) ipld.Node {
func NewBool(value bool) ipld.Node {
return plainBool(value)
}
......
......@@ -12,7 +12,7 @@ var (
_ ipld.NodeAssembler = &plainBytes__Assembler{}
)
func Bytes(value []byte) ipld.Node {
func NewBytes(value []byte) ipld.Node {
return plainBytes(value)
}
......
......@@ -12,7 +12,7 @@ var (
_ ipld.NodeAssembler = &plainFloat__Assembler{}
)
func Float(value float64) ipld.Node {
func NewFloat(value float64) ipld.Node {
return plainFloat(value)
}
......
......@@ -12,7 +12,7 @@ var (
_ ipld.NodeAssembler = &plainInt__Assembler{}
)
func Int(value int) ipld.Node {
func NewInt(value int) ipld.Node {
return plainInt(value)
}
......
......@@ -12,7 +12,7 @@ var (
_ ipld.NodeAssembler = &plainLink__Assembler{}
)
func Link(value ipld.Link) ipld.Node {
func NewLink(value ipld.Link) ipld.Node {
return &plainLink{value}
}
......
......@@ -217,7 +217,7 @@ func (ma *plainMap__Assembler) AssembleDirectly(k string) (ipld.NodeAssembler, e
// Check for dup keys; error if so.
_, exists := ma.w.m[k]
if exists {
return nil, ipld.ErrRepeatedMapKey{String(k)}
return nil, ipld.ErrRepeatedMapKey{plainString(k)}
}
ma.w.t = append(ma.w.t, plainMap__Entry{k: plainString(k)})
// Make value assembler valid by giving it pointer back to whole 'ma'; yield it.
......
......@@ -12,7 +12,7 @@ var (
_ ipld.NodeAssembler = &plainString__Assembler{}
)
func String(value string) ipld.Node {
func NewString(value string) ipld.Node {
return plainString(value)
}
......
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