arrayInterface is like array but returns []any.
()
| 1060 | |
| 1061 | // arrayInterface is like array but returns []any. |
| 1062 | func (d *decodeState) arrayInterface() []any { |
| 1063 | var v = make([]any, 0) |
| 1064 | for { |
| 1065 | // Look ahead for ] - can only happen on first iteration. |
| 1066 | d.scanWhile(scanSkipSpace) |
| 1067 | if d.opcode == scanEndArray { |
| 1068 | break |
| 1069 | } |
| 1070 | |
| 1071 | v = append(v, d.valueInterface()) |
| 1072 | |
| 1073 | // Next token must be , or ]. |
| 1074 | if d.opcode == scanSkipSpace { |
| 1075 | d.scanWhile(scanSkipSpace) |
| 1076 | } |
| 1077 | if d.opcode == scanEndArray { |
| 1078 | break |
| 1079 | } |
| 1080 | if d.opcode != scanArrayValue { |
| 1081 | panic(phasePanicMsg) |
| 1082 | } |
| 1083 | } |
| 1084 | return v |
| 1085 | } |
| 1086 | |
| 1087 | // objectInterface is like object but returns map[string]any. |
| 1088 | func (d *decodeState) objectInterface() map[string]any { |
no test coverage detected