Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 378 for Slice3 (0.15 sec)

  1. test/escape_slice.go

    }
    
    func slice2() []*int {
    	var s []*int
    	i := 0 // ERROR "moved to heap: i"
    	s = append(s, &i)
    	return s
    }
    
    func slice3() *int {
    	var s []*int
    	i := 0 // ERROR "moved to heap: i"
    	s = append(s, &i)
    	for _, p := range s {
    		return p
    	}
    	return nil
    }
    
    func slice4(s []*int) { // ERROR "s does not escape"
    	i := 0 // ERROR "moved to heap: i"
    	s[0] = &i
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 08 18:50:24 UTC 2023
    - 3.9K bytes
    - Viewed (0)
  2. src/go/types/index.go

    		if x.mode != variable {
    			check.errorf(x, NonSliceableOperand, invalidOp+"cannot slice %s (value not addressable)", x)
    			x.mode = invalid
    			return
    		}
    		x.typ = &Slice{elem: u.elem}
    
    	case *Pointer:
    		if u, _ := under(u.base).(*Array); u != nil {
    			valid = true
    			length = u.len
    			x.typ = &Slice{elem: u.elem}
    		}
    
    	case *Slice:
    		valid = true
    		// x.typ doesn't change
    	}
    
    	if !valid {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 22 16:17:05 UTC 2024
    - 11.2K bytes
    - Viewed (0)
  3. src/go/types/exprstring.go

    	case *ast.SliceExpr:
    		WriteExpr(buf, x.X)
    		buf.WriteByte('[')
    		if x.Low != nil {
    			WriteExpr(buf, x.Low)
    		}
    		buf.WriteByte(':')
    		if x.High != nil {
    			WriteExpr(buf, x.High)
    		}
    		if x.Slice3 {
    			buf.WriteByte(':')
    			if x.Max != nil {
    				WriteExpr(buf, x.Max)
    			}
    		}
    		buf.WriteByte(']')
    
    	case *ast.TypeAssertExpr:
    		WriteExpr(buf, x.X)
    		buf.WriteString(".(")
    		WriteExpr(buf, x.Type)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 08 19:31:44 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  4. src/reflect/all_test.go

    	}
    	if !DeepEqual(v[0:4], xs[3:7:7]) {
    		t.Errorf("xs.Slice3(3, 5, 7)[0:4] = %v", v[0:4])
    	}
    	rv := ValueOf(&xs).Elem()
    	shouldPanic("Slice3", func() { rv.Slice3(1, 2, 1) })
    	shouldPanic("Slice3", func() { rv.Slice3(1, 1, 11) })
    	shouldPanic("Slice3", func() { rv.Slice3(2, 2, 1) })
    
    	xa := [8]int{10, 20, 30, 40, 50, 60, 70, 80}
    	v = ValueOf(&xa).Elem().Slice3(2, 5, 6).Interface().([]int)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 218.8K bytes
    - Viewed (0)
  5. test/escape_reflect.go

    func slice1(x []byte) []byte { // ERROR "leaking param: x$"
    	v := reflect.ValueOf(x) // ERROR "x escapes to heap"
    	return v.Slice(1, 2).Bytes()
    }
    
    // Unfortunate: x doesn't need to escape to heap, just to result.
    func slice2(x string) string { // ERROR "leaking param: x$"
    	v := reflect.ValueOf(x) // ERROR "x escapes to heap"
    	return v.Slice(1, 2).String()
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 08 18:50:24 UTC 2023
    - 13.1K bytes
    - Viewed (0)
  6. src/go/parser/parser.go

    	if ncolons > 0 {
    		// slice expression
    		slice3 := false
    		if ncolons == 2 {
    			slice3 = true
    			// Check presence of middle and final index here rather than during type-checking
    			// to prevent erroneous programs from passing through gofmt (was go.dev/issue/7305).
    			if index[1] == nil {
    				p.error(colons[0], "middle index required in 3-index slice")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Dec 08 20:07:50 UTC 2023
    - 72.2K bytes
    - Viewed (0)
  7. src/text/template/funcs.go

    		}
    	}
    	return item, nil
    }
    
    // Slicing.
    
    // slice returns the result of slicing its first argument by the remaining
    // arguments. Thus "slice x 1 2" is, in Go syntax, x[1:2], while "slice x"
    // is x[:], "slice x 1" is x[1:], and "slice x 1 2 3" is x[1:2:3]. The first
    // argument must be a string, slice, or array.
    func slice(item reflect.Value, indexes ...reflect.Value) (reflect.Value, error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 22:23:55 UTC 2024
    - 20.9K bytes
    - Viewed (0)
  8. src/reflect/value.go

    }
    
    // Slice3 is the 3-index form of the slice operation: it returns v[i:j:k].
    // It panics if v's Kind is not [Array] or [Slice], or if v is an unaddressable array,
    // or if the indexes are out of bounds.
    func (v Value) Slice3(i, j, k int) Value {
    	var (
    		cap  int
    		typ  *sliceType
    		base unsafe.Pointer
    	)
    	switch kind := v.kind(); kind {
    	default:
    		panic(&ValueError{"reflect.Value.Slice3", v.kind()})
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 21:17:41 UTC 2024
    - 119.9K bytes
    - Viewed (0)
  9. src/go/parser/parser_test.go

    	{name: "dot", format: "package main; var x = «x.»x"},
    	{name: "index", format: "package main; var x = x«[1]»"},
    	{name: "slice", format: "package main; var x = x«[1:2]»"},
    	{name: "slice3", format: "package main; var x = x«[1:2:3]»"},
    	{name: "dottype", format: "package main; var x = x«.(any)»"},
    	{name: "callseq", format: "package main; var x = x«()»"},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 31 20:26:14 UTC 2024
    - 24.6K bytes
    - Viewed (0)
  10. tensorflow/compiler/mlir/tensorflow/tests/lower_tf.mlir

      // CHECK:      %[[SLICE2:.*]] = "tf.Slice"(%[[CONCAT]], %[[CST3]], %[[CST4]]) : (tensor<3x8x4xi32>, tensor<3xi64>, tensor<3xi64>) -> tensor<3x2x4xi32>
      // CHECK:      %[[SLICE3:.*]] = "tf.Slice"(%[[CONCAT]], %[[CST5]], %[[CST6]]) : (tensor<3x8x4xi32>, tensor<3xi64>, tensor<3xi64>) -> tensor<3x6x4xi32>
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Fri Jan 05 18:35:42 UTC 2024
    - 92K bytes
    - Viewed (0)
Back to top