github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/go/internal/typeparams/typeparams.go (about)

     1  // Copyright 2021 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package typeparams
     6  
     7  import (
     8  	"github.com/shogo82148/std/go/ast"
     9  	"github.com/shogo82148/std/go/token"
    10  )
    11  
    12  func PackIndexExpr(x ast.Expr, lbrack token.Pos, exprs []ast.Expr, rbrack token.Pos) ast.Expr
    13  
    14  // IndexExpr wraps an ast.IndexExpr or ast.IndexListExpr.
    15  //
    16  // Orig holds the original ast.Expr from which this IndexExpr was derived.
    17  //
    18  // Note: IndexExpr (intentionally) does not wrap ast.Expr, as that leads to
    19  // accidental misuse such as encountered in golang/go#63933.
    20  //
    21  // TODO(rfindley): remove this helper, in favor of just having a helper
    22  // function that returns indices.
    23  type IndexExpr struct {
    24  	Orig    ast.Expr
    25  	X       ast.Expr
    26  	Lbrack  token.Pos
    27  	Indices []ast.Expr
    28  	Rbrack  token.Pos
    29  }
    30  
    31  func (x *IndexExpr) Pos() token.Pos
    32  
    33  func UnpackIndexExpr(n ast.Node) *IndexExpr