diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-01-17 14:20:29 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-01-17 14:20:29 +0000 |
commit | c6d6367f848cfd8381aba41e035c5e7e873667c5 (patch) | |
tree | a218e98243463fc27f5053b4444e2544c63cd57a /libgo/go/container | |
parent | 9bff0086915f544fa648ea81131f035cb9ce79a4 (diff) |
libgo: update to Go1.10beta2 release
Reviewed-on: https://go-review.googlesource.com/87897
From-SVN: r256794
Diffstat (limited to 'libgo/go/container')
-rwxr-xr-x | libgo/go/container/list/list.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libgo/go/container/list/list.go b/libgo/go/container/list/list.go index 0256768efe5..dc4260e1316 100755 --- a/libgo/go/container/list/list.go +++ b/libgo/go/container/list/list.go @@ -65,7 +65,7 @@ func New() *List { return new(List).Init() } // The complexity is O(1). func (l *List) Len() int { return l.len } -// Front returns the first element of list l or nil. +// Front returns the first element of list l or nil if the list is empty. func (l *List) Front() *Element { if l.len == 0 { return nil @@ -73,7 +73,7 @@ func (l *List) Front() *Element { return l.root.next } -// Back returns the last element of list l or nil. +// Back returns the last element of list l or nil if the list is empty. func (l *List) Back() *Element { if l.len == 0 { return nil @@ -118,6 +118,7 @@ func (l *List) remove(e *Element) *Element { // Remove removes e from l if e is an element of list l. // It returns the element value e.Value. +// The element must not be nil. func (l *List) Remove(e *Element) interface{} { if e.list == l { // if e.list == l, l must have been initialized when e was inserted @@ -141,6 +142,7 @@ func (l *List) PushBack(v interface{}) *Element { // InsertBefore inserts a new element e with value v immediately before mark and returns e. // If mark is not an element of l, the list is not modified. +// The mark must not be nil. func (l *List) InsertBefore(v interface{}, mark *Element) *Element { if mark.list != l { return nil @@ -151,6 +153,7 @@ func (l *List) InsertBefore(v interface{}, mark *Element) *Element { // InsertAfter inserts a new element e with value v immediately after mark and returns e. // If mark is not an element of l, the list is not modified. +// The mark must not be nil. func (l *List) InsertAfter(v interface{}, mark *Element) *Element { if mark.list != l { return nil @@ -161,6 +164,7 @@ func (l *List) InsertAfter(v interface{}, mark *Element) *Element { // MoveToFront moves element e to the front of list l. // If e is not an element of l, the list is not modified. +// The element must not be nil. func (l *List) MoveToFront(e *Element) { if e.list != l || l.root.next == e { return @@ -171,6 +175,7 @@ func (l *List) MoveToFront(e *Element) { // MoveToBack moves element e to the back of list l. // If e is not an element of l, the list is not modified. +// The element must not be nil. func (l *List) MoveToBack(e *Element) { if e.list != l || l.root.prev == e { return @@ -181,6 +186,7 @@ func (l *List) MoveToBack(e *Element) { // MoveBefore moves element e to its new position before mark. // If e or mark is not an element of l, or e == mark, the list is not modified. +// The element and mark must not be nil. func (l *List) MoveBefore(e, mark *Element) { if e.list != l || e == mark || mark.list != l { return @@ -190,6 +196,7 @@ func (l *List) MoveBefore(e, mark *Element) { // MoveAfter moves element e to its new position after mark. // If e or mark is not an element of l, or e == mark, the list is not modified. +// The element and mark must not be nil. func (l *List) MoveAfter(e, mark *Element) { if e.list != l || e == mark || mark.list != l { return @@ -198,7 +205,7 @@ func (l *List) MoveAfter(e, mark *Element) { } // PushBackList inserts a copy of an other list at the back of list l. -// The lists l and other may be the same. +// The lists l and other may be the same. They must not be nil. func (l *List) PushBackList(other *List) { l.lazyInit() for i, e := other.Len(), other.Front(); i > 0; i, e = i-1, e.Next() { @@ -207,7 +214,7 @@ func (l *List) PushBackList(other *List) { } // PushFrontList inserts a copy of an other list at the front of list l. -// The lists l and other may be the same. +// The lists l and other may be the same. They must not be nil. func (l *List) PushFrontList(other *List) { l.lazyInit() for i, e := other.Len(), other.Back(); i > 0; i, e = i-1, e.Prev() { |