MCPcopy Create free account
hub / github.com/dop251/goja / proxyDefineOwnPropertyPostCheck

Method proxyDefineOwnPropertyPostCheck

proxy.go:385–409  ·  view source on GitHub ↗
(prop Value, target *Object, descr PropertyDescriptor)

Source from the content-addressed store, hash-verified

383}
384
385func (p *proxyObject) proxyDefineOwnPropertyPostCheck(prop Value, target *Object, descr PropertyDescriptor) {
386 targetDesc := propToValueProp(prop)
387 extensibleTarget := target.self.isExtensible()
388 settingConfigFalse := descr.Configurable == FLAG_FALSE
389 if targetDesc == nil {
390 if !extensibleTarget {
391 panic(p.val.runtime.NewTypeError())
392 }
393 if settingConfigFalse {
394 panic(p.val.runtime.NewTypeError())
395 }
396 } else {
397 if !p.__isCompatibleDescriptor(extensibleTarget, &descr, targetDesc) {
398 panic(p.val.runtime.NewTypeError())
399 }
400 if settingConfigFalse && targetDesc.configurable {
401 panic(p.val.runtime.NewTypeError())
402 }
403 if targetDesc.value != nil && !targetDesc.configurable && targetDesc.writable {
404 if descr.Writable == FLAG_FALSE {
405 panic(p.val.runtime.NewTypeError())
406 }
407 }
408 }
409}
410
411func (p *proxyObject) defineOwnPropertyStr(name unistring.String, descr PropertyDescriptor, throw bool) bool {
412 target := p.target

Callers 3

defineOwnPropertyStrMethod · 0.95
defineOwnPropertyIdxMethod · 0.95
defineOwnPropertySymMethod · 0.95

Calls 4

propToValuePropFunction · 0.85
NewTypeErrorMethod · 0.80
isExtensibleMethod · 0.65

Tested by

no test coverage detected