Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(421)

Delta Between Two Patch Sets: src/pkg/reflect/value.go

Issue 7239045: code review 7239045: reflect: Add comment that Value.Slice cannot be called ... (Closed)
Left Patch Set: diff -r b3af92ac5a0c https://go.googlecode.com/hg/ Created 12 years, 1 month ago
Right Patch Set: diff -r 8d4bd93dcd41 https://go.googlecode.com/hg/ Created 12 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package reflect 5 package reflect
6 6
7 import ( 7 import (
8 "math" 8 "math"
9 "runtime" 9 "runtime"
10 "strconv" 10 "strconv"
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 1441
1442 // SetString sets v's underlying value to x. 1442 // SetString sets v's underlying value to x.
1443 // It panics if v's Kind is not String or if CanSet() is false. 1443 // It panics if v's Kind is not String or if CanSet() is false.
1444 func (v Value) SetString(x string) { 1444 func (v Value) SetString(x string) {
1445 v.mustBeAssignable() 1445 v.mustBeAssignable()
1446 v.mustBe(String) 1446 v.mustBe(String)
1447 *(*string)(v.val) = x 1447 *(*string)(v.val) = x
1448 } 1448 }
1449 1449
1450 // Slice returns a slice of v. 1450 // Slice returns a slice of v.
1451 // It panics if v's Kind is not Array, Slice or String, or the array is not addr essable. 1451 // It panics if v's Kind is not Array, Slice or String, or if v is a non-address able array.
rsc 2013/01/31 22:37:09 or if v is a non-addressable array.
1452 func (v Value) Slice(beg, end int) Value { 1452 func (v Value) Slice(beg, end int) Value {
1453 var ( 1453 var (
1454 cap int 1454 cap int
1455 typ *sliceType 1455 typ *sliceType
1456 base unsafe.Pointer 1456 base unsafe.Pointer
1457 ) 1457 )
1458 switch k := v.kind(); k { 1458 switch k := v.kind(); k {
1459 default: 1459 default:
1460 panic(&ValueError{"reflect.Value.Slice", k}) 1460 panic(&ValueError{"reflect.Value.Slice", k})
1461 1461
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
2359 func escapes(x interface{}) { 2359 func escapes(x interface{}) {
2360 if dummy.b { 2360 if dummy.b {
2361 dummy.x = x 2361 dummy.x = x
2362 } 2362 }
2363 } 2363 }
2364 2364
2365 var dummy struct { 2365 var dummy struct {
2366 b bool 2366 b bool
2367 x interface{} 2367 x interface{}
2368 } 2368 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b