(call FunctionCall)
| 266 | } |
| 267 | |
| 268 | func (r *Runtime) arrayproto_toLocaleString(call FunctionCall) Value { |
| 269 | array := call.This.ToObject(r) |
| 270 | |
| 271 | if r.pushToStringStack(array) { |
| 272 | // Circular reference detected, return empty string to avoid infinite recursion |
| 273 | return stringEmpty |
| 274 | } |
| 275 | defer r.popFromStringStack() |
| 276 | |
| 277 | var buf StringBuilder |
| 278 | if a := r.checkStdArrayObj(array); a != nil { |
| 279 | for i, item := range a.values { |
| 280 | if i > 0 { |
| 281 | buf.WriteRune(',') |
| 282 | } |
| 283 | r.writeItemLocaleString(item, &buf) |
| 284 | } |
| 285 | } else { |
| 286 | length := toLength(array.self.getStr("length", nil)) |
| 287 | for i := int64(0); i < length; i++ { |
| 288 | if i > 0 { |
| 289 | buf.WriteRune(',') |
| 290 | } |
| 291 | item := array.self.getIdx(valueInt(i), nil) |
| 292 | r.writeItemLocaleString(item, &buf) |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | return buf.String() |
| 297 | } |
| 298 | |
| 299 | func isConcatSpreadable(obj *Object) bool { |
| 300 | spreadable := obj.self.getSym(SymIsConcatSpreadable, nil) |
nothing calls this directly
no test coverage detected