(name valueInt, val, receiver Value, throw bool)
| 1530 | } |
| 1531 | |
| 1532 | func (o *Object) setIdx(name valueInt, val, receiver Value, throw bool) bool { |
| 1533 | if receiver == o { |
| 1534 | return o.self.setOwnIdx(name, val, throw) |
| 1535 | } |
| 1536 | |
| 1537 | if res, ok := o.self.setForeignIdx(name, val, receiver, throw); !ok { |
| 1538 | if robj, ok := receiver.(*Object); ok { |
| 1539 | if prop := robj.self.getOwnPropIdx(name); prop != nil { |
| 1540 | if desc, ok := prop.(*valueProperty); ok { |
| 1541 | if desc.accessor { |
| 1542 | o.runtime.typeErrorResult(throw, "Receiver property %s is an accessor", name) |
| 1543 | return false |
| 1544 | } |
| 1545 | if !desc.writable { |
| 1546 | o.runtime.typeErrorResult(throw, "Cannot assign to read only property '%s'", name) |
| 1547 | return false |
| 1548 | } |
| 1549 | } |
| 1550 | return robj.self.defineOwnPropertyIdx(name, PropertyDescriptor{Value: val}, throw) |
| 1551 | } |
| 1552 | |
| 1553 | return robj.self.defineOwnPropertyIdx(name, PropertyDescriptor{ |
| 1554 | Value: val, |
| 1555 | Writable: FLAG_TRUE, |
| 1556 | Configurable: FLAG_TRUE, |
| 1557 | Enumerable: FLAG_TRUE, |
| 1558 | }, throw) |
| 1559 | } |
| 1560 | |
| 1561 | o.runtime.typeErrorResult(throw, "Receiver is not an object: %v", receiver) |
| 1562 | return false |
| 1563 | } else { |
| 1564 | return res |
| 1565 | } |
| 1566 | } |
| 1567 | |
| 1568 | func (o *Object) setSym(name *Symbol, val, receiver Value, throw bool) bool { |
| 1569 | if receiver == o { |
no test coverage detected