Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for StringVal (0.24 sec)

  1. src/go/constant/example_test.go

    		if constant.Compare(a, token.LSS, b) {
    			return -1
    		}
    		if constant.Compare(a, token.GTR, b) {
    			return +1
    		}
    		return 0
    	})
    
    	for _, v := range vs {
    		fmt.Println(constant.StringVal(v))
    	}
    
    	// Output:
    	//
    	// Frame
    	// Z
    	// a
    	// bacon
    	// defer
    	// go
    }
    
    func ExampleSign() {
    	zero := constant.MakeInt64(0)
    	one := constant.MakeInt64(1)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  2. src/syscall/js/js.go

    	case string:
    		return makeValue(stringVal(x))
    	case []any:
    		a := arrayConstructor.New(len(x))
    		for i, s := range x {
    			a.SetIndex(i, s)
    		}
    		return a
    	case map[string]any:
    		o := objectConstructor.New()
    		for k, v := range x {
    			o.Set(k, v)
    		}
    		return o
    	default:
    		panic("ValueOf: invalid value")
    	}
    }
    
    // stringVal copies string x to Javascript and returns a ref.
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 19 14:35:26 UTC 2024
    - 19.5K bytes
    - Viewed (0)
  3. src/go/types/builtins.go

    		switch t := arrayPtrDeref(under(x.typ)).(type) {
    		case *Basic:
    			if isString(t) && id == _Len {
    				if x.mode == constant_ {
    					mode = constant_
    					val = constant.MakeInt64(int64(len(constant.StringVal(x.val))))
    				} else {
    					mode = value
    				}
    			}
    
    		case *Array:
    			mode = value
    			// spec: "The expressions len(s) and cap(s) are constants
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 27.2K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/types2/builtins.go

    		switch t := arrayPtrDeref(under(x.typ)).(type) {
    		case *Basic:
    			if isString(t) && id == _Len {
    				if x.mode == constant_ {
    					mode = constant_
    					val = constant.MakeInt64(int64(len(constant.StringVal(x.val))))
    				} else {
    					mode = value
    				}
    			}
    
    		case *Array:
    			mode = value
    			// spec: "The expressions len(s) and cap(s) are constants
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 27.1K bytes
    - Viewed (0)
  5. src/go/types/stmt.go

    		}
    		if x, ok := constant.Uint64Val(val); ok {
    			return x
    		}
    	case constant.Float:
    		if x, ok := constant.Float64Val(val); ok {
    			return x
    		}
    	case constant.String:
    		return constant.StringVal(val)
    	}
    	return nil
    }
    
    // A valueMap maps a case value (of a basic Go type) to a list of positions
    // where the same case value appeared, together with the corresponding case
    // types.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 30.6K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/types2/stmt.go

    		}
    		if x, ok := constant.Uint64Val(val); ok {
    			return x
    		}
    	case constant.Float:
    		if x, ok := constant.Float64Val(val); ok {
    			return x
    		}
    	case constant.String:
    		return constant.StringVal(val)
    	}
    	return nil
    }
    
    // A valueMap maps a case value (of a basic Go type) to a list of positions
    // where the same case value appeared, together with the corresponding case
    // types.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 30.7K bytes
    - Viewed (0)
  7. src/go/types/expr.go

    		fallthrough
    	case constant.Int:
    		if v, ok := constant.Int64Val(x); ok {
    			return v
    		}
    		if v, ok := constant.Uint64Val(x); ok {
    			return v
    		}
    	case constant.String:
    		return constant.StringVal(x)
    	case constant.Bool:
    		return constant.BoolVal(x)
    	}
    	return x
    }
    
    // typeAssertion checks x.(T). The type of x must be an interface.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 02:09:54 UTC 2024
    - 49.7K bytes
    - Viewed (0)
  8. src/cmd/compile/internal/types2/expr.go

    		fallthrough
    	case constant.Int:
    		if v, ok := constant.Int64Val(x); ok {
    			return v
    		}
    		if v, ok := constant.Uint64Val(x); ok {
    			return v
    		}
    	case constant.String:
    		return constant.StringVal(x)
    	case constant.Bool:
    		return constant.BoolVal(x)
    	}
    	return x
    }
    
    // typeAssertion checks x.(T). The type of x must be an interface.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 02:09:54 UTC 2024
    - 51.7K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/ssagen/ssa.go

    			case 8:
    				return s.constInt64(n.Type(), i)
    			default:
    				s.Fatalf("bad integer size %d", n.Type().Size())
    				return nil
    			}
    		case constant.String:
    			i := constant.StringVal(u)
    			if i == "" {
    				return s.constEmptyString(n.Type())
    			}
    			return s.entryNewValue0A(ssa.OpConstString, n.Type(), ssa.StringToAux(i))
    		case constant.Bool:
    			return s.constBool(constant.BoolVal(u))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 19:44:43 UTC 2024
    - 284.9K bytes
    - Viewed (0)
Back to top