(name unistring.String, val Value, throw bool)
| 41 | } |
| 42 | |
| 43 | func (o *objectGoMapSimple) setOwnStr(name unistring.String, val Value, throw bool) bool { |
| 44 | n := name.String() |
| 45 | if _, exists := o.data[n]; exists { |
| 46 | o.data[n] = val.Export() |
| 47 | return true |
| 48 | } |
| 49 | if proto := o.prototype; proto != nil { |
| 50 | // we know it's foreign because prototype loops are not allowed |
| 51 | if res, ok := proto.self.setForeignStr(name, val, o.val, throw); ok { |
| 52 | return res |
| 53 | } |
| 54 | } |
| 55 | // new property |
| 56 | if !o.extensible { |
| 57 | o.val.runtime.typeErrorResult(throw, "Cannot add property %s, object is not extensible", name) |
| 58 | return false |
| 59 | } else { |
| 60 | o.data[n] = val.Export() |
| 61 | } |
| 62 | return true |
| 63 | } |
| 64 | |
| 65 | func trueValIfPresent(present bool) Value { |
| 66 | if present { |
nothing calls this directly
no test coverage detected