Function
newConst
(p *Package, o *types.Const)
Source from the content-addressed store, hash-verified
| 469 | } |
| 470 | |
| 471 | func newConst(p *Package, o *types.Const) (*Const, error) { |
| 472 | pkg := o.Pkg() |
| 473 | sym := p.syms.symtype(o.Type()) |
| 474 | id := pkg.Name() + "_" + o.Name() |
| 475 | doc := p.getDoc("", o) |
| 476 | val := o.Val().String() |
| 477 | |
| 478 | return &Const{ |
| 479 | pkg: p, |
| 480 | sym: sym, |
| 481 | obj: o, |
| 482 | id: id, |
| 483 | doc: doc, |
| 484 | val: val, |
| 485 | }, nil |
| 486 | } |
| 487 | |
| 488 | func (c *Const) ID() string { return c.id } |
| 489 | func (c *Const) Doc() string { return c.doc } |
Tested by
no test coverage detected