(prop *valueProperty, descr PropertyDescriptor, setter func(uint32, bool) bool, throw bool)
| 379 | } |
| 380 | |
| 381 | func (r *Runtime) defineArrayLength(prop *valueProperty, descr PropertyDescriptor, setter func(uint32, bool) bool, throw bool) bool { |
| 382 | var newLen uint32 |
| 383 | ret := true |
| 384 | if descr.Value != nil { |
| 385 | newLen = r.toLengthUint32(descr.Value) |
| 386 | } |
| 387 | |
| 388 | if descr.Configurable == FLAG_TRUE || descr.Enumerable == FLAG_TRUE || descr.Getter != nil || descr.Setter != nil { |
| 389 | ret = false |
| 390 | goto Reject |
| 391 | } |
| 392 | |
| 393 | if descr.Value != nil { |
| 394 | oldLen := uint32(prop.value.ToInteger()) |
| 395 | if oldLen != newLen { |
| 396 | ret = setter(newLen, false) |
| 397 | } |
| 398 | } else { |
| 399 | ret = true |
| 400 | } |
| 401 | |
| 402 | if descr.Writable != FLAG_NOT_SET { |
| 403 | w := descr.Writable.Bool() |
| 404 | if prop.writable { |
| 405 | prop.writable = w |
| 406 | } else { |
| 407 | if w { |
| 408 | ret = false |
| 409 | goto Reject |
| 410 | } |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | Reject: |
| 415 | if !ret { |
| 416 | r.typeErrorResult(throw, "Cannot redefine property: length") |
| 417 | } |
| 418 | |
| 419 | return ret |
| 420 | } |
| 421 | |
| 422 | func (a *arrayObject) _defineIdxProperty(idx uint32, desc PropertyDescriptor, throw bool) bool { |
| 423 | var existing Value |
no test coverage detected