Re: [go-nuts] what does ctxt param to typecheck means?

99 views
Skip to first unread message

Ian Lance Taylor

unread,
Feb 12, 2021, 3:27:48 PM2/12/21
to xie cui, golang-nuts
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
Reply all
Reply to author
Forward
0 new messages