mirror of
https://github.com/golang/go
synced 2024-11-19 09:54:49 -07:00
cmd/compile: remove last c-isms from typecheck.go comments
Change-Id: I0b1ae9d296115000fb30aab39f9eac1200ae68d0 Reviewed-on: https://go-review.googlesource.com/40451 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
7b5f94e76c
commit
55b56d2b2f
@ -23,11 +23,12 @@ const (
|
|||||||
Ecomplit // type in composite literal
|
Ecomplit // type in composite literal
|
||||||
)
|
)
|
||||||
|
|
||||||
// type check the whole tree of an expression.
|
// type checks the whole tree of an expression.
|
||||||
// calculates expression types.
|
// calculates expression types.
|
||||||
// evaluates compile time constants.
|
// evaluates compile time constants.
|
||||||
// marks variables that escape the local frame.
|
// marks variables that escape the local frame.
|
||||||
// rewrites n->op to be more specific in some cases.
|
// rewrites n.Op to be more specific in some cases.
|
||||||
|
|
||||||
var typecheckdefstack []*Node
|
var typecheckdefstack []*Node
|
||||||
|
|
||||||
// resolve ONONAME to definition, if any.
|
// resolve ONONAME to definition, if any.
|
||||||
@ -2180,10 +2181,6 @@ OpSwitch:
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO
|
|
||||||
if(n->type == T)
|
|
||||||
fatal("typecheck nil type");
|
|
||||||
*/
|
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2449,8 +2446,6 @@ func lookdot(n *Node, t *types.Type, dostrcmp int) *types.Field {
|
|||||||
if n.Left.Type == t || n.Left.Type.Sym == nil {
|
if n.Left.Type == t || n.Left.Type.Sym == nil {
|
||||||
mt := methtype(t)
|
mt := methtype(t)
|
||||||
if mt != nil {
|
if mt != nil {
|
||||||
// Use f2->method, not f2->xmethod: adddot has
|
|
||||||
// already inserted all the necessary embedded dots.
|
|
||||||
f2 = lookdot1(n, s, mt, mt.Methods(), dostrcmp)
|
f2 = lookdot1(n, s, mt, mt.Methods(), dostrcmp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2527,7 +2522,7 @@ func lookdot(n *Node, t *types.Type, dostrcmp int) *types.Field {
|
|||||||
}
|
}
|
||||||
if pll.Implicit() && ll.Type.IsPtr() && ll.Type.Sym != nil && asNode(ll.Type.Sym.Def) != nil && asNode(ll.Type.Sym.Def).Op == OTYPE {
|
if pll.Implicit() && ll.Type.IsPtr() && ll.Type.Sym != nil && asNode(ll.Type.Sym.Def) != nil && asNode(ll.Type.Sym.Def).Op == OTYPE {
|
||||||
// It is invalid to automatically dereference a named pointer type when selecting a method.
|
// It is invalid to automatically dereference a named pointer type when selecting a method.
|
||||||
// Make n->left == ll to clarify error message.
|
// Make n.Left == ll to clarify error message.
|
||||||
n.Left = ll
|
n.Left = ll
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -2536,7 +2531,6 @@ func lookdot(n *Node, t *types.Type, dostrcmp int) *types.Field {
|
|||||||
n.Xoffset = f2.Offset
|
n.Xoffset = f2.Offset
|
||||||
n.Type = f2.Type
|
n.Type = f2.Type
|
||||||
|
|
||||||
// print("lookdot found [%p] %T\n", f2->type, f2->type);
|
|
||||||
n.Op = ODOTMETH
|
n.Op = ODOTMETH
|
||||||
|
|
||||||
return f2
|
return f2
|
||||||
@ -2918,7 +2912,7 @@ func typecheckcomplit(n *Node) *Node {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save original node (including n->right)
|
// Save original node (including n.Right)
|
||||||
norig := nod(n.Op, nil, nil)
|
norig := nod(n.Op, nil, nil)
|
||||||
|
|
||||||
*norig = *n
|
*norig = *n
|
||||||
@ -3734,7 +3728,7 @@ func typecheckdef(n *Node) *Node {
|
|||||||
}
|
}
|
||||||
if nsavederrors+nerrors > 0 {
|
if nsavederrors+nerrors > 0 {
|
||||||
// Can have undefined variables in x := foo
|
// Can have undefined variables in x := foo
|
||||||
// that make x have an n->ndefn == nil.
|
// that make x have an n.name.Defn == nil.
|
||||||
// If there are other errors anyway, don't
|
// If there are other errors anyway, don't
|
||||||
// bother adding to the noise.
|
// bother adding to the noise.
|
||||||
break
|
break
|
||||||
@ -3749,7 +3743,7 @@ func typecheckdef(n *Node) *Node {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
n.Name.Defn = typecheck(n.Name.Defn, Etop) // fills in n->type
|
n.Name.Defn = typecheck(n.Name.Defn, Etop) // fills in n.Type
|
||||||
|
|
||||||
case OTYPE:
|
case OTYPE:
|
||||||
if p := n.Name.Param; p.Alias {
|
if p := n.Name.Param; p.Alias {
|
||||||
|
Loading…
Reference in New Issue
Block a user