Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 216 for IsString (0.49 sec)

  1. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/timeformat/timeformat.go

    func badFormatAt(info *types.Info, e ast.Expr) int {
    	tv, ok := info.Types[e]
    	if !ok { // no type info, assume good
    		return -1
    	}
    
    	t, ok := tv.Type.(*types.Basic) // sic, no unalias
    	if !ok || t.Info()&types.IsString == 0 {
    		return -1
    	}
    
    	if tv.Value == nil {
    		return -1
    	}
    
    	return strings.Index(constant.StringVal(tv.Value), badFormat)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  2. operator/pkg/util/reflect.go

    func kindOf(value any) reflect.Kind {
    	if value == nil {
    		return reflect.Invalid
    	}
    	return reflect.TypeOf(value).Kind()
    }
    
    // IsString reports whether value is a string type.
    func IsString(value any) bool {
    	return kindOf(value) == reflect.String
    }
    
    // IsPtr reports whether value is a ptr type.
    func IsPtr(value any) bool {
    	return kindOf(value) == reflect.Ptr
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jul 25 19:30:47 UTC 2022
    - 8.6K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/types2/under.go

    // a string, the result is of type (possibly untyped) string.
    func coreString(t Type) Type {
    	t = Unalias(t)
    	tpar, _ := t.(*TypeParam)
    	if tpar == nil {
    		return under(t) // string or untyped string
    	}
    
    	var su Type
    	hasString := false
    	if tpar.underIs(func(u Type) bool {
    		if u == nil {
    			return false
    		}
    		if isString(u) {
    			u = NewSlice(universeByte)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 21 22:34:27 UTC 2024
    - 2.7K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/ir/const.go

    func NewInt(pos src.XPos, v int64) Node {
    	return NewBasicLit(pos, types.UntypedInt, constant.MakeInt64(v))
    }
    
    // NewString returns an OLITERAL representing s as an untyped string.
    func NewString(pos src.XPos, s string) Node {
    	return NewBasicLit(pos, types.UntypedString, constant.MakeString(s))
    }
    
    // NewUintptr returns an OLITERAL representing v as a uintptr.
    func NewUintptr(pos src.XPos, v int64) Node {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 12 18:53:26 UTC 2023
    - 4K bytes
    - Viewed (0)
  5. src/go/types/gcsizes.go

    		// StdSizes.Alignof won't be called for them.
    		assert(!isTypeParam(T))
    		return s.WordSize
    	case *Basic:
    		// Strings are like slices and interfaces.
    		if t.Info()&IsString != 0 {
    			return s.WordSize
    		}
    	case *TypeParam, *Union:
    		panic("unreachable")
    	}
    	a := s.Sizeof(T) // may be 0 or negative
    	// spec: "For a variable x of any type: unsafe.Alignof(x) is at least 1."
    	if a < 1 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 4.4K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/types2/gcsizes.go

    		// StdSizes.Alignof won't be called for them.
    		assert(!isTypeParam(T))
    		return s.WordSize
    	case *Basic:
    		// Strings are like slices and interfaces.
    		if t.Info()&IsString != 0 {
    			return s.WordSize
    		}
    	case *TypeParam, *Union:
    		panic("unreachable")
    	}
    	a := s.Sizeof(T) // may be 0 or negative
    	// spec: "For a variable x of any type: unsafe.Alignof(x) is at least 1."
    	if a < 1 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 22 19:32:17 UTC 2024
    - 4.2K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/types2/const.go

    				*rounded = constant.BinaryOp(re, token.ADD, constant.MakeImag(im))
    				return true
    			}
    		case UntypedComplex:
    			return true
    		default:
    			panic("unreachable")
    		}
    
    	case isString(typ):
    		return x.Kind() == constant.String
    
    	case isBoolean(typ):
    		return x.Kind() == constant.Bool
    	}
    
    	return false
    }
    
    func fitsFloat32(x constant.Value) bool {
    	f32, _ := constant.Float32Val(x)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 22 19:32:17 UTC 2024
    - 7.5K bytes
    - Viewed (0)
  8. src/go/types/const.go

    				*rounded = constant.BinaryOp(re, token.ADD, constant.MakeImag(im))
    				return true
    			}
    		case UntypedComplex:
    			return true
    		default:
    			panic("unreachable")
    		}
    
    	case isString(typ):
    		return x.Kind() == constant.String
    
    	case isBoolean(typ):
    		return x.Kind() == constant.Bool
    	}
    
    	return false
    }
    
    func fitsFloat32(x constant.Value) bool {
    	f32, _ := constant.Float32Val(x)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 7.6K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/types2/sizes.go

    		// StdSizes.Alignof won't be called for them.
    		assert(!isTypeParam(T))
    		return s.WordSize
    	case *Basic:
    		// Strings are like slices and interfaces.
    		if t.Info()&IsString != 0 {
    			return s.WordSize
    		}
    	case *TypeParam, *Union:
    		panic("unreachable")
    	}
    	a := s.Sizeof(T) // may be 0 or negative
    	// spec: "For a variable x of any type: unsafe.Alignof(x) is at least 1."
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:53:03 UTC 2024
    - 8.8K bytes
    - Viewed (0)
  10. src/go/types/sizes.go

    		// StdSizes.Alignof won't be called for them.
    		assert(!isTypeParam(T))
    		return s.WordSize
    	case *Basic:
    		// Strings are like slices and interfaces.
    		if t.Info()&IsString != 0 {
    			return s.WordSize
    		}
    	case *TypeParam, *Union:
    		panic("unreachable")
    	}
    	a := s.Sizeof(T) // may be 0 or negative
    	// spec: "For a variable x of any type: unsafe.Alignof(x) is at least 1."
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 8.9K bytes
    - Viewed (0)
Back to top