]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/compile: remove uses of types.Dclstack - not needed anymore
authorRobert Griesemer <gri@golang.org>
Tue, 18 Apr 2017 22:21:02 +0000 (15:21 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 19 Apr 2017 00:36:55 +0000 (00:36 +0000)
Follow-up on https://go-review.googlesource.com/#/c/39998/.

Change-Id: I8830eebd7ea7e02b7edda99e67b6d43529401201
Reviewed-on: https://go-review.googlesource.com/40974
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/bimport.go
src/cmd/compile/internal/gc/noder.go
src/cmd/compile/internal/types/scope.go

index ea9c02dea871e07665dc8f29d6b0d095faf30bd9..245f4217316cb2661ae4bd7f1da72aa6b8327aaa 100644 (file)
@@ -1161,9 +1161,7 @@ func (p *importer) node() *Node {
        //      unreachable - not emitted by exporter
 
        case OGOTO, OLABEL:
-               n := nodl(p.pos(), op, newname(p.expr().Sym), nil)
-               n.Sym = types.Dclstack // context, for goto restrictions
-               return n
+               return nodl(p.pos(), op, newname(p.expr().Sym), nil)
 
        case OEND:
                return nil
index 27c842150b6edf2b4fbe4e98b42b1ad3598e8423..f0c501b1557053a929cb3ac0d4fa4a1a97e1a3a6 100644 (file)
@@ -725,9 +725,6 @@ func (p *noder) stmt(stmt syntax.Stmt) *Node {
                if stmt.Label != nil {
                        n.Left = p.newname(stmt.Label)
                }
-               if op == OGOTO {
-                       n.Sym = types.Dclstack // context, for goto restriction
-               }
                if op == OXFALL {
                        n.Xoffset = int64(types.Block)
                }
@@ -909,7 +906,6 @@ func (p *noder) commClauses(clauses []*syntax.CommClause) []*Node {
 
 func (p *noder) labeledStmt(label *syntax.LabeledStmt) *Node {
        lhs := p.nod(label, OLABEL, p.newname(label.Label), nil)
-       lhs.Sym = types.Dclstack // context, for goto restriction
 
        var ls *Node
        if label.Stmt != nil { // TODO(mdempsky): Should always be present.
index 9ee3f796f74ca7e901c03b0a305d8bdbf2d7d494..67de273f252db8c0ab504b1d5e2eac370713deaf 100644 (file)
@@ -14,19 +14,19 @@ import (
 var blockgen int32 = 1 // max block number
 var Block int32        // current block number
 
-// Dclstack maintains a stack of shadowed symbol declarations so that
+// dclstack maintains a stack of shadowed symbol declarations so that
 // popdcl can restore their declarations when a block scope ends.
 // The stack is maintained as a linked list, using Sym's Link field.
 //
 // In practice, the "stack" actually ends up forming a tree: goto and label
-// statements record the current state of Dclstack so that checkgoto can
+// statements record the current state of dclstack so that checkgoto can
 // validate that a goto statement does not jump over any declarations or
 // into a new block scope.
 //
 // Finally, the Syms in this list are not "real" Syms as they don't actually
 // represent object names. Sym is just a convenient type for saving shadowed
 // Sym definitions, and only a subset of its fields are actually used.
-var Dclstack *Sym
+var dclstack *Sym
 
 func dcopy(a, b *Sym) {
        a.Pkg = b.Pkg
@@ -39,8 +39,8 @@ func dcopy(a, b *Sym) {
 func push(pos src.XPos) *Sym {
        d := new(Sym)
        d.Lastlineno = pos
-       d.Link = Dclstack
-       Dclstack = d
+       d.Link = dclstack
+       dclstack = d
        return d
 }
 
@@ -54,7 +54,7 @@ func Pushdcl(s *Sym, pos src.XPos) {
 // Popdcl pops the innermost block scope and restores all symbol declarations
 // to their previous state.
 func Popdcl() {
-       d := Dclstack
+       d := dclstack
        for ; d != nil && d.Name != ""; d = d.Link {
                s := d.Pkg.Lookup(d.Name)
                lno := s.Lastlineno
@@ -66,7 +66,7 @@ func Popdcl() {
                Fatalf("popdcl: no mark")
        }
 
-       Dclstack = d.Link // pop mark
+       dclstack = d.Link // pop mark
        Block = d.Block
 }
 
@@ -83,7 +83,7 @@ func Markdcl(lineno src.XPos) {
 // keep around for debugging
 func DumpDclstack() {
        i := 0
-       for d := Dclstack; d != nil; d = d.Link {
+       for d := dclstack; d != nil; d = d.Link {
                fmt.Printf("%6d  %p", i, d)
                if d.Name != "" {
                        fmt.Printf("  '%s'  %v\n", d.Name, d.Pkg.Lookup(d.Name))
@@ -95,7 +95,7 @@ func DumpDclstack() {
 }
 
 func IsDclstackValid() bool {
-       for d := Dclstack; d != nil; d = d.Link {
+       for d := dclstack; d != nil; d = d.Link {
                if d.Name == "" {
                        return false
                }