MCPcopy Index your code
hub / github.com/go-python/gopy / addConst

Method addConst

bind/package.go:559–582  ·  view source on GitHub ↗
(obj *types.Const)

Source from the content-addressed store, hash-verified

557}
558
559func (p *Package) addConst(obj *types.Const) {
560 if ntyp, ok := obj.Type().(*types.Named); ok {
561 enm := p.findEnum(ntyp)
562 if enm != nil {
563 enm.AddConst(p, obj)
564 return
565 } else {
566 val := obj.Val().String()
567 _, err := strconv.Atoi(val)
568 if err == nil {
569 enm, err := newEnum(p, obj)
570 if err == nil {
571 p.enums = append(p.enums, enm)
572 return
573 }
574 }
575 }
576 }
577
578 nc, err := newConst(p, obj)
579 if err == nil {
580 p.consts = append(p.consts, nc)
581 }
582}
583
584func (p *Package) addVar(obj *types.Var) {
585 nv, err := newVarFrom(p, obj)

Callers 1

processMethod · 0.95

Calls 5

findEnumMethod · 0.95
newEnumFunction · 0.85
newConstFunction · 0.85
AddConstMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected