Set replaces the object named attribute n if any - creates a new object by appending to the slice of named attributes otherwise. The resulting object is returned in both cases.
(n string, att *AttributeExpr)
| 471 | // appending to the slice of named attributes otherwise. The resulting object is |
| 472 | // returned in both cases. |
| 473 | func (o *Object) Set(n string, att *AttributeExpr) { |
| 474 | for _, nat := range *o { |
| 475 | if nat.Name == n { |
| 476 | nat.Attribute = att |
| 477 | return |
| 478 | } |
| 479 | } |
| 480 | *o = append(*o, &NamedAttributeExpr{n, att}) |
| 481 | } |
| 482 | |
| 483 | // Delete creates a new object with the same named attributes as o but without |
| 484 | // the named attribute n if any. |
no outgoing calls