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

     1  // Copyright 2009 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 typecheck
     6  
     7  import (
     8  	"github.com/shogo82148/std/cmd/compile/internal/ir"
     9  	"github.com/shogo82148/std/cmd/compile/internal/types"
    10  	"github.com/shogo82148/std/cmd/internal/src"
    11  )
    12  
    13  func AssignExpr(n ir.Node) ir.Node
    14  func Expr(n ir.Node) ir.Node
    15  func Stmt(n ir.Node) ir.Node
    16  
    17  func Exprs(exprs []ir.Node)
    18  func Stmts(stmts []ir.Node)
    19  
    20  func Call(pos src.XPos, callee ir.Node, args []ir.Node, dots bool) ir.Node
    21  
    22  func Callee(n ir.Node) ir.Node
    23  
    24  // RewriteNonNameCall replaces non-Name call expressions with temps,
    25  // rewriting f()(...) to t0 := f(); t0(...).
    26  func RewriteNonNameCall(n *ir.CallExpr)
    27  
    28  // RewriteMultiValueCall rewrites multi-valued f() to use temporaries,
    29  // so the backend wouldn't need to worry about tuple-valued expressions.
    30  func RewriteMultiValueCall(n ir.InitNode, call ir.Node)
    31  
    32  // Lookdot1 looks up the specified method s in the list fs of methods, returning
    33  // the matching field or nil. If dostrcmp is 0, it matches the symbols. If
    34  // dostrcmp is 1, it matches by name exactly. If dostrcmp is 2, it matches names
    35  // with case folding.
    36  func Lookdot1(errnode ir.Node, s *types.Sym, t *types.Type, fs []*types.Field, dostrcmp int) *types.Field
    37  
    38  // NewMethodExpr returns an OMETHEXPR node representing method
    39  // expression "recv.sym".
    40  func NewMethodExpr(pos src.XPos, recv *types.Type, sym *types.Sym) *ir.SelectorExpr
    41  
    42  // Lookdot looks up field or method n.Sel in the type t and returns the matching
    43  // field. It transforms the op of node n to ODOTINTER or ODOTMETH, if appropriate.
    44  // It also may add a StarExpr node to n.X as needed for access to non-pointer
    45  // methods. If dostrcmp is 0, it matches the field/method with the exact symbol
    46  // as n.Sel (appropriate for exported fields). If dostrcmp is 1, it matches by name
    47  // exactly. If dostrcmp is 2, it matches names with case folding.
    48  func Lookdot(n *ir.SelectorExpr, t *types.Type, dostrcmp int) *types.Field
    49  
    50  func Conv(n ir.Node, t *types.Type) ir.Node
    51  
    52  // ConvNop converts node n to type t using the OCONVNOP op
    53  // and typechecks the result with ctxExpr.
    54  func ConvNop(n ir.Node, t *types.Type) ir.Node