]> Cypherpunks repositories - gostls13.git/commitdiff
compile/internal/gc: make typecheckok a bool
authorHÃ¥vard Haugen <havard.haugen@gmail.com>
Sun, 30 Aug 2015 21:56:40 +0000 (23:56 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 2 Sep 2015 19:08:19 +0000 (19:08 +0000)
Change-Id: Ib3960321a4c8164f6b221bfd15977d2f34dbc65b
Reviewed-on: https://go-review.googlesource.com/14175
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/dcl.go
src/cmd/compile/internal/gc/go.go
src/cmd/compile/internal/gc/lex.go
src/cmd/compile/internal/gc/typecheck.go

index 99f29f4830d0fdb9bc2a34519175c54f454f90eb..157f525b1961ab05bd8e8c24d29a50bb5ef49bfa 100644 (file)
@@ -182,7 +182,7 @@ func declare(n *Node, ctxt uint8) {
        s := n.Sym
 
        // kludgy: typecheckok means we're past parsing.  Eg genwrapper may declare out of package names later.
-       if importpkg == nil && typecheckok == 0 && s.Pkg != localpkg {
+       if importpkg == nil && !typecheckok && s.Pkg != localpkg {
                Yyerror("cannot declare name %v", s)
        }
 
index b692fc826c3cac86bb74119f549b3f2199bdf723..8c7328fa4bb990e95e8b10c67d925a684c72786b 100644 (file)
@@ -638,7 +638,7 @@ var thunk int32
 
 var Funcdepth int32
 
-var typecheckok int
+var typecheckok bool
 
 var compiling_runtime int
 
index 863fa8860b73d5269690d93fada028ab4f96fb1b..3fab3582ed5844ce83c3abd1c1a92aba00fcf788 100644 (file)
@@ -360,7 +360,7 @@ func Main() {
        mkpackage(localpkg.Name) // final import not used checks
        lexfini()
 
-       typecheckok = 1
+       typecheckok = true
        if Debug['f'] != 0 {
                frame(1)
        }
@@ -799,7 +799,7 @@ func importfile(f *Val, line int) {
        curio.peekc1 = 0
        curio.infile = file
        curio.nlsemi = 0
-       typecheckok = 1
+       typecheckok = true
 
        var c int32
        for {
@@ -836,7 +836,7 @@ func unimportfile() {
 
        pushedio.bin = nil
        incannedimport = 0
-       typecheckok = 0
+       typecheckok = false
 }
 
 func cannedimports(file string, cp string) {
@@ -852,7 +852,7 @@ func cannedimports(file string, cp string) {
        curio.nlsemi = 0
        curio.importsafe = false
 
-       typecheckok = 1
+       typecheckok = true
        incannedimport = 1
 }
 
index 502c62c252d75e0d03cc72860576f5c00ccaa09b..ff394f4f5e9fe72f3f322fca216d54ac93709c1f 100644 (file)
@@ -118,7 +118,7 @@ var typecheck_tcfree *NodeList
 
 func typecheck(np **Node, top int) *Node {
        // cannot type check until all the source has been parsed
-       if typecheckok == 0 {
+       if !typecheckok {
                Fatalf("early typecheck")
        }