(v reflect.Value, value *unstable.Node)
| 1858 | } |
| 1859 | |
| 1860 | func (d *decoder) assignLocalTime(v reflect.Value, value *unstable.Node) (reflect.Value, error) { |
| 1861 | t, rest, err := parseLocalTime(value.Data) |
| 1862 | if err != nil { |
| 1863 | return reflect.Value{}, err |
| 1864 | } |
| 1865 | if len(rest) > 0 { |
| 1866 | return reflect.Value{}, unstable.NewParserError(rest, "extra characters at the end of a local time") |
| 1867 | } |
| 1868 | |
| 1869 | switch v.Type() { |
| 1870 | case localTimeType: |
| 1871 | v.Set(reflect.ValueOf(t)) |
| 1872 | return v, nil |
| 1873 | case timeType: |
| 1874 | v.Set(reflect.ValueOf(time.Date(0, 1, 1, t.Hour, t.Minute, t.Second, t.Nanosecond, time.Local))) |
| 1875 | return v, nil |
| 1876 | } |
| 1877 | if v.Kind() == reflect.Interface { |
| 1878 | return boxInto(v, reflect.ValueOf(t)) |
| 1879 | } |
| 1880 | return reflect.Value{}, d.typeMismatchError("local time", v.Type(), d.p.Raw(value.Raw)) |
| 1881 | } |
| 1882 | |
| 1883 | func (d *decoder) assignArray(v reflect.Value, expr *unstable.Node, value *unstable.Node) (reflect.Value, error) { |
| 1884 | // Count the elements to allocate the target in one go. |
no test coverage detected