On Fri, Feb 12, 2021 at 7:14 AM xie cui <
cuiw...@gmail.com> wrote:
>
>
https://github.com/golang/go/blob/master/src/cmd/compile/internal/gc/typecheck.go
> i feel had to understand the param ctxt to typecheck, could you explain to me?
I'm sorry, can you be more specific? The declaration of typecheck is
func typecheck(n *Node, top int) (res *Node) {
It does not have a param "ctx".
If you are asking about the parameter "top", it holds a bitmask of
values like ctxStmt and ctxExpr. The bits in the bitmask describing
how the value being type checked (the parameter "n") is being used:
whether it is being used as a statement, as an expression, and so
forth.
Ian