]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove last c-isms from typecheck.go comments
authorAlberto Donizetti <alb.donizetti@gmail.com>
Wed, 12 Apr 2017 17:17:11 +0000 (19:17 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 13 Apr 2017 15:40:32 +0000 (15:40 +0000)
Change-Id: I0b1ae9d296115000fb30aab39f9eac1200ae68d0
Reviewed-on: https://go-review.googlesource.com/40451
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/typecheck.go

index 2e7664ccd238a21af98b59110066260c6e75e89c..e78634a86728e13c3b9a27cf0137e6d74a94b7f1 100644 (file)
@@ -23,11 +23,12 @@ const (
        Ecomplit              // type in composite literal
 )
 
-// type check the whole tree of an expression.
+// type checks the whole tree of an expression.
 // calculates expression types.
 // evaluates compile time constants.
 // 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
 
 // resolve ONONAME to definition, if any.
@@ -2180,10 +2181,6 @@ OpSwitch:
                return n
        }
 
-       /* TODO
-       if(n->type == T)
-               fatal("typecheck nil type");
-       */
        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 {
                mt := methtype(t)
                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)
                }
        }
@@ -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 {
                        // 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
                        return nil
                }
@@ -2536,7 +2531,6 @@ func lookdot(n *Node, t *types.Type, dostrcmp int) *types.Field {
                n.Xoffset = f2.Offset
                n.Type = f2.Type
 
-               //              print("lookdot found [%p] %T\n", f2->type, f2->type);
                n.Op = ODOTMETH
 
                return f2
@@ -2918,7 +2912,7 @@ func typecheckcomplit(n *Node) *Node {
                return n
        }
 
-       // Save original node (including n->right)
+       // Save original node (including n.Right)
        norig := nod(n.Op, nil, nil)
 
        *norig = *n
@@ -3734,7 +3728,7 @@ func typecheckdef(n *Node) *Node {
                        }
                        if nsavederrors+nerrors > 0 {
                                // 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
                                // bother adding to the noise.
                                break
@@ -3749,7 +3743,7 @@ func typecheckdef(n *Node) *Node {
                        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:
                if p := n.Name.Param; p.Alias {