Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for makeFromLiteral (0.6 sec)

  1. src/go/types/util.go

    // endPos returns the position of the first character immediately after node n.
    func endPos(n ast.Node) token.Pos { return n.End() }
    
    // makeFromLiteral returns the constant value for the given literal string and kind.
    func makeFromLiteral(lit string, kind token.Token) constant.Value {
    	return constant.MakeFromLiteral(lit, kind, 0)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/types2/util.go

    func endPos(n syntax.Node) syntax.Pos { return syntax.EndPos(n) }
    
    // makeFromLiteral returns the constant value for the given literal string and kind.
    func makeFromLiteral(lit string, kind syntax.LitKind) constant.Value {
    	return constant.MakeFromLiteral(lit, kind2tok[kind], 0)
    }
    
    var kind2tok = [...]token.Token{
    	syntax.IntLit:    token.INT,
    	syntax.FloatLit:  token.FLOAT,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 2.1K bytes
    - Viewed (0)
  3. src/go/constant/value_test.go

    			continue
    		}
    
    		x := MakeFromLiteral(a[0], kind, 0)
    		var y Value
    		if a[1] == "?" {
    			y = MakeUnknown()
    		} else {
    			if ns, ds, ok := strings.Cut(a[1], "/"); ok && kind == token.FLOAT {
    				n := MakeFromLiteral(ns, token.INT, 0)
    				d := MakeFromLiteral(ds, token.INT, 0)
    				y = BinaryOp(n, token.QUO, d)
    			} else {
    				y = MakeFromLiteral(a[1], kind, 0)
    			}
    			if y.Kind() == Unknown {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 15.6K bytes
    - Viewed (0)
  4. src/go/constant/example_test.go

    func ExampleCompare() {
    	vs := []constant.Value{
    		constant.MakeString("Z"),
    		constant.MakeString("bacon"),
    		constant.MakeString("go"),
    		constant.MakeString("Frame"),
    		constant.MakeString("defer"),
    		constant.MakeFromLiteral(`"a"`, token.STRING, 0),
    	}
    
    	slices.SortFunc(vs, func(a, b constant.Value) int {
    		if constant.Compare(a, token.LSS, b) {
    			return -1
    		}
    		if constant.Compare(a, token.GTR, b) {
    			return +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)
  5. src/go/internal/gccgoimporter/parser.go

    			im = re
    			re = "0"
    
    		default:
    			val = constant.MakeFromLiteral(re, token.FLOAT, 0)
    			if val == nil {
    				p.error("could not parse float literal")
    			}
    			typ = types.Typ[types.UntypedFloat]
    			return
    		}
    
    		p.expectKeyword("i")
    		reval := constant.MakeFromLiteral(re, token.FLOAT, 0)
    		if reval == nil {
    			p.error("could not parse real component of complex literal")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 02 23:14:07 UTC 2024
    - 31.2K bytes
    - Viewed (0)
  6. src/go/types/operand.go

    	case token.IMAG:
    		kind = UntypedComplex
    	case token.CHAR:
    		kind = UntypedRune
    	case token.STRING:
    		kind = UntypedString
    	default:
    		panic("unreachable")
    	}
    
    	val := makeFromLiteral(lit, k)
    	if val.Kind() == constant.Unknown {
    		x.mode = invalid
    		x.typ = Typ[Invalid]
    		return
    	}
    	x.mode = constant_
    	x.typ = Typ[kind]
    	x.val = val
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 21:17:10 UTC 2024
    - 11.1K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/types2/operand.go

    	case syntax.ImagLit:
    		kind = UntypedComplex
    	case syntax.RuneLit:
    		kind = UntypedRune
    	case syntax.StringLit:
    		kind = UntypedString
    	default:
    		panic("unreachable")
    	}
    
    	val := makeFromLiteral(lit, k)
    	if val.Kind() == constant.Unknown {
    		x.mode = invalid
    		x.typ = Typ[Invalid]
    		return
    	}
    	x.mode = constant_
    	x.typ = Typ[kind]
    	x.val = val
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 21:17:10 UTC 2024
    - 11K bytes
    - Viewed (0)
  8. src/go/constant/value.go

    }
    
    // MakeFromLiteral returns the corresponding integer, floating-point,
    // imaginary, character, or string value for a Go literal string. The
    // tok value must be one of [token.INT], [token.FLOAT], [token.IMAG],
    // [token.CHAR], or [token.STRING]. The final argument must be zero.
    // If the literal string syntax is invalid, the result is an [Unknown].
    func MakeFromLiteral(lit string, tok token.Token, zero uint) Value {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 34K bytes
    - Viewed (0)
  9. api/go1.5.txt

    pkg go/constant, func Int64Val(Value) (int64, bool)
    pkg go/constant, func MakeBool(bool) Value
    pkg go/constant, func MakeFloat64(float64) Value
    pkg go/constant, func MakeFromBytes([]uint8) Value
    pkg go/constant, func MakeFromLiteral(string, token.Token, uint) Value
    pkg go/constant, func MakeImag(Value) Value
    pkg go/constant, func MakeInt64(int64) Value
    pkg go/constant, func MakeString(string) Value
    pkg go/constant, func MakeUint64(uint64) Value
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jul 30 21:14:09 UTC 2015
    - 46.6K bytes
    - Viewed (0)
  10. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"Int", Const, 5},
    		{"Int64Val", Func, 5},
    		{"Kind", Type, 5},
    		{"Make", Func, 13},
    		{"MakeBool", Func, 5},
    		{"MakeFloat64", Func, 5},
    		{"MakeFromBytes", Func, 5},
    		{"MakeFromLiteral", Func, 5},
    		{"MakeImag", Func, 5},
    		{"MakeInt64", Func, 5},
    		{"MakeString", Func, 5},
    		{"MakeUint64", Func, 5},
    		{"MakeUnknown", Func, 5},
    		{"Num", Func, 5},
    		{"Real", Func, 5},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 534.2K bytes
    - Viewed (0)
Back to top