Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 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)
Back to top