Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 21 for LookupFieldOrMethod (0.26 sec)

  1. 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)
  2. src/go/types/lookup.go

    //     the method's formal receiver base type, nor was the receiver addressable.
    func LookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string) (obj Object, index []int, indirect bool) {
    	if T == nil {
    		panic("LookupFieldOrMethod on nil type")
    	}
    	return lookupFieldOrMethod(T, addressable, pkg, name, false)
    }
    
    // lookupFieldOrMethod is like LookupFieldOrMethod but with the additional foldCase parameter
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 19.9K bytes
    - Viewed (0)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. src/go/types/call.go

    			///          may be other situations.
    			disabled := true
    			if !disabled && debug {
    				// Verify that LookupFieldOrMethod and MethodSet.Lookup agree.
    				// TODO(gri) This only works because we call LookupFieldOrMethod
    				// _before_ calling NewMethodSet: LookupFieldOrMethod completes
    				// any incomplete interfaces so they are available to NewMethodSet
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 33.5K bytes
    - Viewed (0)
  8. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go

    		// would just panic anyway.
    		return false
    	}
    	if types.ConvertibleTo(typ, errorType) {
    		return true // via .Error()
    	}
    
    	// Does it implement fmt.Stringer?
    	if obj, _, _ := types.LookupFieldOrMethod(typ, false, nil, "String"); obj != nil {
    		if fn, ok := obj.(*types.Func); ok {
    			sig := fn.Type().(*types.Signature)
    			if sig.Params().Len() == 0 &&
    				sig.Results().Len() == 1 &&
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 8.6K bytes
    - Viewed (0)
  9. src/go/internal/gcimporter/gcimporter_test.go

    	typ, ok := obj.Type().(*types.Named)
    	if !ok {
    		t.Fatalf("go/types.Object type is %v; wanted named type", typ)
    	}
    
    	// lookup go/types.Object.Pkg method
    	m, index, indirect := types.LookupFieldOrMethod(typ, false, nil, "Pkg")
    	if m == nil {
    		t.Fatalf("go/types.Object.Pkg not found (index = %v, indirect = %v)", index, indirect)
    	}
    
    	// the method must belong to go/types
    	if m.Pkg().Path() != "go/types" {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 16:22:59 UTC 2024
    - 21.9K bytes
    - Viewed (0)
  10. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go

    	if isFormatter(typ) {
    		return "", false
    	}
    
    	// Does e allow e.String() or e.Error()?
    	strObj, _, _ := types.LookupFieldOrMethod(typ, false, pass.Pkg, "String")
    	strMethod, strOk := strObj.(*types.Func)
    	errObj, _, _ := types.LookupFieldOrMethod(typ, false, pass.Pkg, "Error")
    	errMethod, errOk := errObj.(*types.Func)
    	if !strOk && !errOk {
    		return "", false
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 32.5K bytes
    - Viewed (0)
Back to top