QualifyIfPresent conditionally qualifies the variable and only records a value if one is present.
(vars Activation, obj any, presenceOnly bool)
| 1645 | |
| 1646 | // QualifyIfPresent conditionally qualifies the variable and only records a value if one is present. |
| 1647 | func (e *evalWatchQual) QualifyIfPresent(vars Activation, obj any, presenceOnly bool) (any, bool, error) { |
| 1648 | out, present, err := e.Qualifier.QualifyIfPresent(vars, obj, presenceOnly) |
| 1649 | var val ref.Val |
| 1650 | if err != nil { |
| 1651 | val = types.LabelErrNode(e.ID(), types.WrapErr(err)) |
| 1652 | } else if out != nil { |
| 1653 | val = e.adapter.NativeToValue(out) |
| 1654 | } else if presenceOnly { |
| 1655 | val = types.Bool(present) |
| 1656 | } |
| 1657 | if present || presenceOnly { |
| 1658 | e.observer(vars, e.ID(), e.Qualifier, val) |
| 1659 | } |
| 1660 | return out, present, err |
| 1661 | } |
| 1662 | |
| 1663 | // evalWatchConst describes a watcher of an instConst Interpretable. |
| 1664 | type evalWatchConst struct { |
nothing calls this directly
no test coverage detected