Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for UnpackIndexExpr (0.22 sec)

  1. src/cmd/vendor/golang.org/x/tools/internal/typeparams/common.go

    // number of index expressions.
    //
    // For nodes that don't represent index expressions, the first return value of
    // UnpackIndexExpr will be nil.
    func UnpackIndexExpr(n ast.Node) (x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) {
    	switch e := n.(type) {
    	case *ast.IndexExpr:
    		return e.X, e.Lbrack, []ast.Expr{e.Index}, e.Rbrack
    	case *ast.IndexListExpr:
    		return e.X, e.Lbrack, e.Indices, e.Rbrack
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 02:38:00 UTC 2024
    - 4.3K bytes
    - Viewed (0)
  2. src/go/internal/typeparams/typeparams.go

    	Lbrack  token.Pos  // position of "["
    	Indices []ast.Expr // index expressions
    	Rbrack  token.Pos  // position of "]"
    }
    
    func (x *IndexExpr) Pos() token.Pos {
    	return x.Orig.Pos()
    }
    
    func UnpackIndexExpr(n ast.Node) *IndexExpr {
    	switch e := n.(type) {
    	case *ast.IndexExpr:
    		return &IndexExpr{
    			Orig:    e,
    			X:       e.X,
    			Lbrack:  e.Lbrack,
    			Indices: []ast.Expr{e.Index},
    			Rbrack:  e.Rbrack,
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 22 16:17:05 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  3. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/nilfunc/nilfunc.go

    			obj = pass.TypesInfo.Uses[v]
    		case *ast.SelectorExpr:
    			obj = pass.TypesInfo.Uses[v.Sel]
    		case *ast.IndexExpr, *ast.IndexListExpr:
    			// Check generic functions such as "f[T1,T2]".
    			x, _, _, _ := typeparams.UnpackIndexExpr(v)
    			if id, ok := x.(*ast.Ident); ok {
    				obj = pass.TypesInfo.Uses[id]
    			}
    		default:
    			return
    		}
    
    		// Only want functions.
    		if _, ok := obj.(*types.Func); !ok {
    			return
    		}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 18 21:28:13 UTC 2023
    - 2K bytes
    - Viewed (0)
  4. src/cmd/vendor/golang.org/x/tools/go/types/typeutil/callee.go

    		// it is a *types.Func and not a *types.Var.
    		// Example: Don't match a slice m within the expression `m[0]()`.
    		isInstance = true
    		fun, _, _, _ = typeparams.UnpackIndexExpr(fun)
    	}
    
    	var obj types.Object
    	switch fun := fun.(type) {
    	case *ast.Ident:
    		obj = info.Uses[fun] // type, var, builtin, or declared func
    	case *ast.SelectorExpr:
    		if sel, ok := info.Selections[fun]; ok {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 18 21:28:13 UTC 2023
    - 2.1K bytes
    - Viewed (0)
  5. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/testinggoroutine/util.go

    			return true
    		}
    	}
    	return false
    }
    
    func funcIdent(fun ast.Expr) *ast.Ident {
    	switch fun := astutil.Unparen(fun).(type) {
    	case *ast.IndexExpr, *ast.IndexListExpr:
    		x, _, _, _ := typeparams.UnpackIndexExpr(fun) // necessary?
    		id, _ := x.(*ast.Ident)
    		return id
    	case *ast.Ident:
    		return fun
    	default:
    		return nil
    	}
    }
    
    // funcLitInScope returns a FuncLit that id is at least initially assigned to.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 2.4K bytes
    - Viewed (0)
  6. src/go/types/exprstring.go

    		WriteExpr(buf, x.X)
    		buf.WriteByte(')')
    
    	case *ast.SelectorExpr:
    		WriteExpr(buf, x.X)
    		buf.WriteByte('.')
    		buf.WriteString(x.Sel.Name)
    
    	case *ast.IndexExpr, *ast.IndexListExpr:
    		ix := typeparams.UnpackIndexExpr(x)
    		WriteExpr(buf, ix.X)
    		buf.WriteByte('[')
    		writeExprList(buf, ix.Indices)
    		buf.WriteByte(']')
    
    	case *ast.SliceExpr:
    		WriteExpr(buf, x.X)
    		buf.WriteByte('[')
    		if x.Low != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 08 19:31:44 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  7. src/go/types/call.go

    		}
    	}).describef(atPos(pos), "verify instantiation")
    
    	return inst
    }
    
    func (check *Checker) callExpr(x *operand, call *ast.CallExpr) exprKind {
    	ix := typeparams.UnpackIndexExpr(call.Fun)
    	if ix != nil {
    		if check.indexExpr(x, ix) {
    			// Delay function instantiation to argument checking,
    			// where we combine type and value arguments for type
    			// inference.
    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/go/types/typexpr.go

    		case novalue:
    			check.errorf(&x, NotAType, "%s used as type", &x)
    		default:
    			check.errorf(&x, NotAType, "%s is not a type", &x)
    		}
    
    	case *ast.IndexExpr, *ast.IndexListExpr:
    		ix := typeparams.UnpackIndexExpr(e)
    		check.verifyVersionf(inNode(e, ix.Lbrack), go1_18, "type instantiation")
    		return check.instantiatedType(ix, def)
    
    	case *ast.ParenExpr:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 16.3K bytes
    - Viewed (0)
  9. src/go/types/resolver.go

    			ptr = true
    			rtyp = t.X
    		default:
    			break L
    		}
    	}
    
    	// unpack type parameters, if any
    	switch rtyp.(type) {
    	case *ast.IndexExpr, *ast.IndexListExpr:
    		ix := typeparams.UnpackIndexExpr(rtyp)
    		rtyp = ix.X
    		if unpackParams {
    			for _, arg := range ix.Indices {
    				var par *ast.Ident
    				switch arg := arg.(type) {
    				case *ast.Ident:
    					par = arg
    				case *ast.BadExpr:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 16:22:59 UTC 2024
    - 26.1K bytes
    - Viewed (0)
  10. src/go/types/expr.go

    		x.expr = e
    		return kind
    
    	case *ast.SelectorExpr:
    		check.selector(x, e, nil, false)
    
    	case *ast.IndexExpr, *ast.IndexListExpr:
    		ix := typeparams.UnpackIndexExpr(e)
    		if check.indexExpr(x, ix) {
    			if !enableReverseTypeInference {
    				T = nil
    			}
    			check.funcInst(T, e.Pos(), x, ix, true)
    		}
    		if x.mode == invalid {
    			goto Error
    		}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 02:09:54 UTC 2024
    - 49.7K bytes
    - Viewed (0)
Back to top