...
1
2
3
4
5 package goobj
6
7
8
9
10
11
12
13 func NBuiltin() int {
14 return len(builtins)
15 }
16
17
18
19 func BuiltinName(i int) (string, int) {
20 return builtins[i].name, builtins[i].abi
21 }
22
23
24
25 func BuiltinIdx(name string, abi int) int {
26 i, ok := builtinMap[name]
27 if !ok {
28 return -1
29 }
30 if builtins[i].abi != abi {
31 return -1
32 }
33 return i
34 }
35
36
37
38 var builtinMap map[string]int
39
40 func init() {
41 builtinMap = make(map[string]int, len(builtins))
42 for i, b := range builtins {
43 builtinMap[b.name] = i
44 }
45 }
46
View as plain text