Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for LookupFieldOrMethod (0.23 sec)

  1. src/go/types/lookup_test.go

    package types_test
    
    import (
    	"go/importer"
    	"go/token"
    	"path/filepath"
    	"runtime"
    	"testing"
    
    	. "go/types"
    )
    
    // BenchmarkLookupFieldOrMethod measures types.LookupFieldOrMethod performance.
    // LookupFieldOrMethod is a performance hotspot for both type-checking and
    // external API calls.
    func BenchmarkLookupFieldOrMethod(b *testing.B) {
    	// Choose an arbitrary, large package.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 13 15:31:43 UTC 2022
    - 1.2K bytes
    - Viewed (0)
  2. src/go/types/instantiate_test.go

    	for _, test := range tests {
    		src := prefix + test.decl
    		pkg := mustTypecheck(src, nil, nil)
    		typ := NewPointer(pkg.Scope().Lookup("X").Type())
    		obj, _, _ := LookupFieldOrMethod(typ, false, pkg, "m")
    		m, _ := obj.(*Func)
    		if m == nil {
    			t.Fatalf(`LookupFieldOrMethod(%s, "m") = %v, want func m`, typ, obj)
    		}
    		if got := ObjectString(m, RelativeTo(pkg)); got != test.want {
    			t.Errorf("instantiated %q, want %q", got, test.want)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 5.9K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/types2/lookup_test.go

    package types2_test
    
    import (
    	"path/filepath"
    	"runtime"
    	"testing"
    
    	. "cmd/compile/internal/types2"
    )
    
    // BenchmarkLookupFieldOrMethod measures types.LookupFieldOrMethod performance.
    // LookupFieldOrMethod is a performance hotspot for both type-checking and
    // external API calls.
    func BenchmarkLookupFieldOrMethod(b *testing.B) {
    	// Choose an arbitrary, large package.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 13 15:31:35 UTC 2022
    - 1.2K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/types2/instantiate_test.go

    	for _, test := range tests {
    		src := prefix + test.decl
    		pkg := mustTypecheck(src, nil, nil)
    		typ := NewPointer(pkg.Scope().Lookup("X").Type())
    		obj, _, _ := LookupFieldOrMethod(typ, false, pkg, "m")
    		m, _ := obj.(*Func)
    		if m == nil {
    			t.Fatalf(`LookupFieldOrMethod(%s, "m") = %v, want func m`, typ, obj)
    		}
    		if got := ObjectString(m, RelativeTo(pkg)); got != test.want {
    			t.Errorf("instantiated %q, want %q", got, test.want)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 28 17:58:07 UTC 2023
    - 5.8K bytes
    - Viewed (0)
  5. src/go/types/methodset.go

    //       internally if LookupFieldOrMethod completed the same
    //       interfaces beforehand.
    
    // NewMethodSet returns the method set for the given type T.
    // It always returns a non-nil method set, even if it is empty.
    func NewMethodSet(T Type) *MethodSet {
    	// WARNING: The code in this function is extremely subtle - do not modify casually!
    	//          This function and lookupFieldOrMethod should be kept in sync.
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 7.1K bytes
    - Viewed (0)
  6. src/cmd/vendor/golang.org/x/tools/internal/typesinternal/toonew.go

    			if t := pkg.Scope().Lookup(typename); t != nil && disallowed[t] == "" {
    				obj, _, _ = types.LookupFieldOrMethod(t.Type(), false, pkg, name)
    			}
    
    		case stdlib.Method:
    			ptr, recvname, name := sym.SplitMethod()
    			if t := pkg.Scope().Lookup(recvname); t != nil && disallowed[t] == "" {
    				obj, _, _ = types.LookupFieldOrMethod(t.Type(), ptr, pkg, name)
    			}
    		}
    		if obj != nil {
    			disallowed[obj] = symVersion
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 2.9K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/types2/object_test.go

    	// get original error.Error method
    	eface := Universe.Lookup("error")
    	orig, _, _ := LookupFieldOrMethod(eface.Type(), false, nil, "Error")
    	if orig == nil {
    		t.Fatalf("original error.Error not found")
    	}
    
    	// get embedded error.Error method
    	iface := pkg.Scope().Lookup("I")
    	embed, _, _ := LookupFieldOrMethod(iface.Type(), false, nil, "Error")
    	if embed == nil {
    		t.Fatalf("embedded error.Error not found")
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 18 14:10:44 UTC 2024
    - 5.2K bytes
    - Viewed (0)
  8. src/go/types/object_test.go

    	// get original error.Error method
    	eface := Universe.Lookup("error")
    	orig, _, _ := LookupFieldOrMethod(eface.Type(), false, nil, "Error")
    	if orig == nil {
    		t.Fatalf("original error.Error not found")
    	}
    
    	// get embedded error.Error method
    	iface := pkg.Scope().Lookup("I")
    	embed, _, _ := LookupFieldOrMethod(iface.Type(), false, nil, "Error")
    	if embed == nil {
    		t.Fatalf("embedded error.Error not found")
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 18 14:10:44 UTC 2024
    - 5.2K bytes
    - Viewed (0)
  9. src/go/types/methodset_test.go

    	}
    
    	// look up T.m and (*T).m
    	T := pkg.Scope().Lookup("T").Type()
    	name := "m"
    	for _, recv := range []Type{T, NewPointer(T)} {
    		// LookupFieldOrMethod and NewMethodSet must match:
    		// either both find m or neither finds it.
    		obj1, _, _ := LookupFieldOrMethod(recv, false, pkg, name)
    		mset := NewMethodSet(recv)
    		if (obj1 != nil) != (mset.Len() == 1) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 08 15:27:57 UTC 2023
    - 6.7K bytes
    - Viewed (0)
  10. src/internal/types/testdata/check/decls2/decls2a.go

    }
    
    func (T1b) int /* ERROR "field and method" */ () {}
    
    type T1c struct {
    	time.Time
    }
    
    func (T1c) Time /* ERROR "field and method with the same name Time" */ () int { return 0 }
    
    // Disabled for now: LookupFieldOrMethod will find Pointer even though
    // it's double-declared (it would cost extra in the common case to verify
    // this). But the MethodSet computation will not find it due to the name
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 3.3K bytes
    - Viewed (0)
Back to top