Search Options

Results per page
Sort
Preferred Languages
Advance

Results 91 - 100 of 523 for Map (0.02 sec)

  1. src/reflect/set_test.go

    	{
    		// direct
    		m := make(map[int]int)
    		mv := ValueOf(m)
    		mv.SetMapIndex(ValueOf(1), ValueOf(2))
    		x, ok := m[1]
    		if x != 2 {
    			t.Errorf("#1 after SetMapIndex(1,2): %d, %t (map=%v)", x, ok, m)
    		}
    		if n := mv.MapIndex(ValueOf(1)).Interface().(int); n != 2 {
    			t.Errorf("#1 MapIndex(1) = %d", n)
    		}
    	}
    	{
    		// convert interface key
    		m := make(map[any]int)
    		mv := ValueOf(m)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 07 13:56:11 UTC 2022
    - 5.7K bytes
    - Viewed (0)
  2. test/live2.go

    package main
    
    // issue 8142: lost 'addrtaken' bit on inlined variables.
    
    func printnl()
    
    //go:noescape
    func useT40(*T40)
    
    type T40 struct {
    	m map[int]int
    }
    
    func newT40() *T40 {
    	ret := T40{}
    	ret.m = make(map[int]int, 42) // ERROR "live at call to makemap: &ret$"
    	return &ret
    }
    
    func bad40() {
    	t := newT40() // ERROR "stack object ret T40$" "stack object .autotmp_[0-9]+ runtime.hmap$"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 21 23:29:33 UTC 2023
    - 953 bytes
    - Viewed (0)
  3. src/internal/coverage/rtcov/rtcov.go

    		CounterMode:        cmode,
    		CounterGranularity: cgran,
    	})
    	if pkgid != -1 {
    		if Meta.PkgMap == nil {
    			Meta.PkgMap = make(map[int]int)
    		}
    		if _, ok := Meta.PkgMap[pkgid]; ok {
    			return 0
    		}
    		// Record the real slot (position on meta-list) for this
    		// package; we'll use the map to fix things up later on.
    		Meta.PkgMap[pkgid] = slot
    	}
    
    	// ID zero is reserved as invalid.
    	return uint32(slot + 1)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 09:57:47 UTC 2024
    - 3.1K bytes
    - Viewed (0)
  4. src/net/rpc/jsonrpc/client.go

    	mutex   sync.Mutex        // protects pending
    	pending map[uint64]string // map request id to method name
    }
    
    // NewClientCodec returns a new [rpc.ClientCodec] using JSON-RPC on conn.
    func NewClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec {
    	return &clientCodec{
    		dec:     json.NewDecoder(conn),
    		enc:     json.NewEncoder(conn),
    		c:       conn,
    		pending: make(map[uint64]string),
    	}
    }
    
    type clientRequest struct {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 10 03:29:50 UTC 2024
    - 3K bytes
    - Viewed (0)
  5. test/typeparam/issue53087.go

    	str string
    }
    
    func (s *S) M() {}
    
    var _ I = &S{}
    
    type CloningMap[K comparable, V any] struct {
    	inner map[K]V
    }
    
    func (cm CloningMap[K, V]) With(key K, value V) CloningMap[K, V] {
    	result := CloneBad(cm.inner)
    	result[key] = value
    	return CloningMap[K, V]{result}
    }
    
    func CloneBad[M ~map[K]V, K comparable, V any](m M) M {
    	r := make(M, len(m))
    	for k, v := range m {
    		r[k] = v
    	}
    	return r
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 08 16:23:09 UTC 2023
    - 930 bytes
    - Viewed (0)
  6. test/fixedbugs/issue53635.go

    func main() {
    	f[int]()
    }
    
    func f[T any]() {
    	switch []T(nil) {
    	case nil:
    	default:
    		panic("FAIL")
    	}
    
    	switch (func() T)(nil) {
    	case nil:
    	default:
    		panic("FAIL")
    	}
    
    	switch (map[int]T)(nil) {
    	case nil:
    	default:
    		panic("FAIL")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jul 08 12:57:49 UTC 2022
    - 423 bytes
    - Viewed (0)
  7. src/go/parser/resolver_test.go

    // '=@bar'. It returns a map of name->position for declarations, and
    // name->position(s) for uses.
    func positionMarkers(handle *token.File, src []byte) (decls map[string]token.Pos, uses map[string][]token.Pos) {
    	var s scanner.Scanner
    	s.Init(handle, src, nil, scanner.ScanComments)
    	decls = make(map[string]token.Pos)
    	uses = make(map[string][]token.Pos)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Aug 19 17:46:07 UTC 2022
    - 4.9K bytes
    - Viewed (0)
  8. src/go/types/methodset.go

    	// We must use a lookup on identity rather than a simple map[*Named]bool as
    	// instantiated types may be identical but not equal.
    	var seen instanceLookup
    
    	// collect methods at current depth
    	for len(current) > 0 {
    		var next []embeddedType // embedded types found at current depth
    
    		// field and method sets at current depth, indexed by names (Id's), and allocated lazily
    		var fset map[string]bool // we only care about the field names
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 7.1K bytes
    - Viewed (0)
  9. src/internal/trace/reader.go

    			go121Events: convertOldFormat(tr),
    		}, nil
    	case version.Go122, version.Go123:
    		return &Reader{
    			r: br,
    			order: ordering{
    				mStates:     make(map[ThreadID]*mState),
    				pStates:     make(map[ProcID]*pState),
    				gStates:     make(map[GoID]*gState),
    				activeTasks: make(map[TaskID]taskState),
    			},
    			// Don't emit a sync event when we first go to emit events.
    			emittedSync: true,
    		}, nil
    	default:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 6.7K bytes
    - Viewed (0)
  10. test/linknameasm.dir/x.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Test that a linkname applied on an assembly declaration
    // does not affect stack map generation.
    
    package main
    
    import (
    	"runtime"
    	_ "unsafe"
    )
    
    //go:linkname asm
    func asm(*int)
    
    func main() {
    	x := new(int)
    	asm(x)
    }
    
    // called from asm
    func callback() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 07 15:22:22 UTC 2024
    - 451 bytes
    - Viewed (0)
Back to top