validationErrorLocation returns the location of the DSL that declared the given expression when available. The location is derived from the expression DSL function pointer and is used to annotate validation errors (i.e. errors returned by Validate()).
(expr Expression)
| 132 | // The location is derived from the expression DSL function pointer and is used |
| 133 | // to annotate validation errors (i.e. errors returned by Validate()). |
| 134 | func validationErrorLocation(expr Expression) (file string, line int, ok bool) { |
| 135 | source, ok := expr.(Source) |
| 136 | if !ok { |
| 137 | return "", 0, false |
| 138 | } |
| 139 | fn := source.DSL() |
| 140 | if fn == nil { |
| 141 | return "", 0, false |
| 142 | } |
| 143 | return dslFuncLocation(fn) |
| 144 | } |
| 145 | |
| 146 | // dslFuncLocation returns the file and line where the given DSL function is |
| 147 | // declared. |
no test coverage detected