]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: simplify exporting OTYPE nodes
authorMatthew Dempsky <mdempsky@google.com>
Tue, 12 Sep 2017 20:42:10 +0000 (13:42 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 13 Sep 2017 18:31:16 +0000 (18:31 +0000)
We only export packages that typechecked successfully, and OTYPE nodes
will always have their Type field set.

Changes the package export format, but only in the compiler-specific
section. No version bump necessary.

Change-Id: I722f5827e73948fceb0432bc8b3b22471fea8f61
Reviewed-on: https://go-review.googlesource.com/63273
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
src/cmd/compile/internal/gc/bexport.go
src/cmd/compile/internal/gc/bimport.go

index 076b8a91e2442cf4696e99667da12cd75bd03b20..7608d927a579098bdda38ba6683b1c70170fe6cc 100644 (file)
@@ -1227,11 +1227,7 @@ func (p *exporter) expr(n *Node) {
        case OTYPE:
                p.op(OTYPE)
                p.pos(n)
-               if p.bool(n.Type == nil) {
-                       p.sym(n)
-               } else {
-                       p.typ(n.Type)
-               }
+               p.typ(n.Type)
 
        // case OTARRAY, OTMAP, OTCHAN, OTSTRUCT, OTINTER, OTFUNC:
        //      should have been resolved by typechecking - handled by default case
index 661d34112bf918601b80cde74b05216562ba84e2..7cd155c4cb09354e32afbee08e3bf9944619da03 100644 (file)
@@ -947,11 +947,7 @@ func (p *importer) node() *Node {
        //      unreachable - should have been resolved by typechecking
 
        case OTYPE:
-               pos := p.pos()
-               if p.bool() {
-                       return npos(pos, mkname(p.sym()))
-               }
-               return npos(pos, typenod(p.typ()))
+               return npos(p.pos(), typenod(p.typ()))
 
        // case OTARRAY, OTMAP, OTCHAN, OTSTRUCT, OTINTER, OTFUNC:
        //      unreachable - should have been resolved by typechecking