...
1
2
3
4
5 package typecheck
6
7 import (
8 "cmd/compile/internal/base"
9 "cmd/compile/internal/ir"
10 "cmd/compile/internal/types"
11 "cmd/internal/src"
12 )
13
14
15 func importfunc(s *types.Sym, t *types.Type) {
16 fn := ir.NewFunc(src.NoXPos, src.NoXPos, s, t)
17 importsym(fn.Nname)
18 }
19
20
21 func importvar(s *types.Sym, t *types.Type) {
22 n := ir.NewNameAt(src.NoXPos, s, t)
23 n.Class = ir.PEXTERN
24 importsym(n)
25 }
26
27 func importsym(name *ir.Name) {
28 sym := name.Sym()
29 if sym.Def != nil {
30 base.Fatalf("importsym of symbol that already exists: %v", sym.Def)
31 }
32 sym.Def = name
33 }
34
View as plain text