Add adds a parameter to this set and returns the numbered location used for it
(param Param)
| 33 | |
| 34 | // Add adds a parameter to this set and returns the numbered location used for it |
| 35 | func (p *ParamSet) Add(param Param) int { |
| 36 | name := param.name |
| 37 | existing, ok := p.namedParams[name] |
| 38 | |
| 39 | p.namedParams[name] = mergeParam(existing, param) |
| 40 | if ok && p.hasNamedSupport { |
| 41 | return p.namedLocs[name][0] |
| 42 | } |
| 43 | |
| 44 | argn := p.nextArgNum() |
| 45 | p.positionToName[argn] = name |
| 46 | p.namedLocs[name] = append(p.namedLocs[name], argn) |
| 47 | return argn |
| 48 | } |
| 49 | |
| 50 | // FetchMerge fetches an indexed parameter, and merges `mergeP` into it |
| 51 | // Returns: the merged parameter and whether it was a named parameter |