Also: Adjust go/importer accordingly.
Change-Id: Ia6669563793e218946af45b9fba1cf986a21c031
Reviewed-on: https://go-review.googlesource.com/21896
Reviewed-by: Alan Donovan <adonovan@google.com>
Fatalf("exporter: local package path not empty: %q", localpkg.Path)
}
p.pkg(localpkg)
-
- // write compiler-specific flags
- // TODO(gri) move this into the compiler-specific export data section
- {
- var flags string
- if safemode != 0 {
- flags = "safe"
- }
- p.string(flags)
- }
if p.trace {
p.tracef("\n")
}
// export objects
-
+ //
// First, export all exported (package-level) objects; i.e., all objects
// in the current exportlist. These objects represent all information
// required to import this package and type-check against it; i.e., this
}
}
+ // write compiler-specific flags
+ p.bool(safemode != 0)
+ if p.trace {
+ p.tracef("\n")
+ }
+
// Phase 2: Export objects added to exportlist during phase 1.
// Don't use range since exportlist may grow during this phase
// and we want to export all remaining objects.
Fatalf("importer: imported package not found in pkgList[0]")
}
- // read compiler-specific flags
- importpkg.Safe = p.string() == "safe"
-
// defer some type-checking until all types are read in completely
// (parser.go:import_package)
tcok := typecheckok
// read objects
- // Phase 1
+ // phase 1
objcount := 0
for {
tag := p.tagOrIndex()
// --- compiler-specific export data ---
- // Phase 2
+ // read compiler-specific flags
+ importpkg.Safe = p.bool()
+
+ // phase 2
objcount = 0
for {
tag := p.tagOrIndex()
}
default:
- Fatalf("importer: unexpected object tag")
+ Fatalf("importer: unexpected object (tag = %d)", tag)
}
}
panic("imported packaged not found in pkgList[0]")
}
- // read compiler-specific flags
- p.string() // discard
-
// read objects of phase 1 only (see cmd/compiler/internal/gc/bexport.go)
objcount := 0
for {
p.declare(types.NewFunc(token.NoPos, pkg, name, sig))
default:
- panic("unexpected object tag")
+ panic(fmt.Sprintf("unexpected object tag %d", tag))
}
}