package typeparams

import "go/internal/typeparams"

Index

Functions

func PackIndexExpr

func PackIndexExpr(x ast.Expr, lbrack token.Pos, exprs []ast.Expr, rbrack token.Pos) ast.Expr

Types

type IndexExpr

type IndexExpr struct {
	Orig    ast.Expr   // the wrapped expr, which may be distinct from the IndexListExpr below.
	X       ast.Expr   // expression
	Lbrack  token.Pos  // position of "["
	Indices []ast.Expr // index expressions
	Rbrack  token.Pos  // position of "]"
}

IndexExpr wraps an ast.IndexExpr or ast.IndexListExpr.

Orig holds the original ast.Expr from which this IndexExpr was derived.

Note: IndexExpr (intentionally) does not wrap ast.Expr, as that leads to accidental misuse such as encountered in golang/go#63933.

TODO(rfindley): remove this helper, in favor of just having a helper function that returns indices.

func UnpackIndexExpr

func UnpackIndexExpr(n ast.Node) *IndexExpr

func (*IndexExpr) Pos

func (x *IndexExpr) Pos() token.Pos

Source Files

typeparams.go

Version
v1.23.0
Published
Aug 7, 2024
Platform
js/wasm
Imports
2 packages
Last checked
1 minute ago

Tools for package owners.