AsDArray attempts to retrieve a *DArray from an Expr, returning a *DArray and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DArray wrapped by a *DOidWrapper is possible.
(e Expr)
| 3312 | // be used instead of direct type assertions wherever a *DArray wrapped by a |
| 3313 | // *DOidWrapper is possible. |
| 3314 | func AsDArray(e Expr) (*DArray, bool) { |
| 3315 | switch t := e.(type) { |
| 3316 | case *DArray: |
| 3317 | return t, true |
| 3318 | case *DOidWrapper: |
| 3319 | return AsDArray(t.Wrapped) |
| 3320 | } |
| 3321 | return nil, false |
| 3322 | } |
| 3323 | |
| 3324 | // MustBeDArray attempts to retrieve a *DArray from an Expr, panicking if the |
| 3325 | // assertion fails. |
no outgoing calls
no test coverage detected
searching dependent graphs…