Merge pull request #302 from aboodman/stable-gen

nomgen: stabilize the order types are generated in across runs
This commit is contained in:
Aaron Boodman
2015-09-16 17:41:39 -07:00
8 changed files with 595 additions and 560 deletions
+45 -45
View File
@@ -8,6 +8,51 @@ import (
"github.com/attic-labs/noms/types"
)
// Commit
type Commit struct {
m types.Map
}
func NewCommit() Commit {
return Commit{
types.NewMap(types.NewString("$name"), types.NewString("Commit")),
}
}
func CommitFromVal(v types.Value) Commit {
return Commit{v.(types.Map)}
}
// TODO: This was going to be called Value() but it collides with root.value. We need some other place to put the built-in fields like Value() and Equals().
func (s Commit) NomsValue() types.Map {
return s.m
}
func (s Commit) Equals(p Commit) bool {
return s.m.Equals(p.m)
}
func (s Commit) Ref() ref.Ref {
return s.m.Ref()
}
func (s Commit) Parents() types.Set {
return types.SetFromVal(s.m.Get(types.NewString("parents")))
}
func (s Commit) SetParents(p types.Set) Commit {
return CommitFromVal(s.m.Set(types.NewString("parents"), p))
}
func (s Commit) Value() types.Value {
return (s.m.Get(types.NewString("value")))
}
func (s Commit) SetValue(p types.Value) Commit {
return CommitFromVal(s.m.Set(types.NewString("value"), p))
}
// SetOfCommit
type SetOfCommit struct {
@@ -90,48 +135,3 @@ func (s SetOfCommit) fromElemSlice(p []Commit) []types.Value {
return r
}
// Commit
type Commit struct {
m types.Map
}
func NewCommit() Commit {
return Commit{
types.NewMap(types.NewString("$name"), types.NewString("Commit")),
}
}
func CommitFromVal(v types.Value) Commit {
return Commit{v.(types.Map)}
}
// TODO: This was going to be called Value() but it collides with root.value. We need some other place to put the built-in fields like Value() and Equals().
func (s Commit) NomsValue() types.Map {
return s.m
}
func (s Commit) Equals(p Commit) bool {
return s.m.Equals(p.m)
}
func (s Commit) Ref() ref.Ref {
return s.m.Ref()
}
func (s Commit) Parents() types.Set {
return types.SetFromVal(s.m.Get(types.NewString("parents")))
}
func (s Commit) SetParents(p types.Set) Commit {
return CommitFromVal(s.m.Set(types.NewString("parents"), p))
}
func (s Commit) Value() types.Value {
return (s.m.Get(types.NewString("value")))
}
func (s Commit) SetValue(p types.Value) Commit {
return CommitFromVal(s.m.Set(types.NewString("value"), p))
}