Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for isValidIndex (0.14 sec)

  1. src/cmd/compile/internal/types2/index.go

    	}
    
    	// 0 <= v [ && v < max ]
    	return x.typ, v
    }
    
    // isValidIndex checks whether operand x satisfies the criteria for integer
    // index values. If allowNegative is set, a constant operand may be negative.
    // If the operand is not valid, an error is reported (using what as context)
    // and the result is false.
    func (check *Checker) isValidIndex(x *operand, code Code, what string, allowNegative bool) bool {
    	if x.mode == invalid {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 15 16:16:58 UTC 2023
    - 11.5K bytes
    - Viewed (0)
  2. src/go/types/index.go

    func (check *Checker) index(index ast.Expr, max int64) (typ Type, val int64) {
    	typ = Typ[Invalid]
    	val = -1
    
    	var x operand
    	check.expr(nil, &x, index)
    	if !check.isValidIndex(&x, InvalidIndex, "index", false) {
    		return
    	}
    
    	if x.mode != constant_ {
    		return x.typ, -1
    	}
    
    	if x.val.Kind() == constant.Unknown {
    		return
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 22 16:17:05 UTC 2024
    - 11.2K bytes
    - Viewed (0)
  3. src/go/types/builtins.go

    		check.verifyVersionf(call.Fun, go1_17, "unsafe.Add")
    
    		check.assignment(x, Typ[UnsafePointer], "argument to unsafe.Add")
    		if x.mode == invalid {
    			return
    		}
    
    		y := args[1]
    		if !check.isValidIndex(y, InvalidUnsafeAdd, "length", true) {
    			return
    		}
    
    		x.mode = value
    		x.typ = Typ[UnsafePointer]
    		if check.recordTypes() {
    			check.recordBuiltinType(call.Fun, makeSig(x.typ, x.typ, y.typ))
    		}
    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

    		check.verifyVersionf(call.Fun, go1_17, "unsafe.Add")
    
    		check.assignment(x, Typ[UnsafePointer], "argument to unsafe.Add")
    		if x.mode == invalid {
    			return
    		}
    
    		y := args[1]
    		if !check.isValidIndex(y, InvalidUnsafeAdd, "length", true) {
    			return
    		}
    
    		x.mode = value
    		x.typ = Typ[UnsafePointer]
    		if check.recordTypes() {
    			check.recordBuiltinType(call.Fun, makeSig(x.typ, x.typ, y.typ))
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 27.1K bytes
    - Viewed (0)
Back to top