| 1 |
// Copyright 2015 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
// This file implements support functionality for iimport.go. |
| 6 |
|
| 7 |
package importer |
| 8 |
|
| 9 |
import ( |
| 10 |
"cmd/compile/internal/base" |
| 11 |
"cmd/compile/internal/types2" |
| 12 |
"go/token" |
| 13 |
"internal/pkgbits" |
| 14 |
) |
| 15 |
|
| 16 |
func assert(p bool) { |
| 17 |
base.Assert(p) |
| 18 |
} |
| 19 |
|
| 20 |
const deltaNewFile = -64 // see cmd/compile/internal/gc/bexport.go |
| 21 |
|
| 22 |
// Synthesize a token.Pos |
| 23 |
type fakeFileSet struct { |
| 24 |
fset *token.FileSet |
| 25 |
files map[string]*token.File |
| 26 |
} |
| 27 |
|
| 28 |
type anyType struct{} |
| 29 |
|
| 30 |
func (t anyType) Underlying() types2.Type { return t } |
| 31 |
func (t anyType) String() string { return "any" } |
| 32 |
|
| 33 |
// See cmd/compile/internal/noder.derivedInfo. |
| 34 |
type derivedInfo struct { |
| 35 |
idx pkgbits.Index |
| 36 |
needed bool |
| 37 |
} |
| 38 |
|
| 39 |
// See cmd/compile/internal/noder.typeInfo. |
| 40 |
type typeInfo struct { |
| 41 |
idx pkgbits.Index |
| 42 |
derived bool |
| 43 |
} |