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

Method proxyGetChecks

proxy.go:587–599  ·  view source on GitHub ↗
(targetProp, trapResult Value, name fmt.Stringer)

Source from the content-addressed store, hash-verified

585}
586
587func (p *proxyObject) proxyGetChecks(targetProp, trapResult Value, name fmt.Stringer) {
588 if targetDesc, ok := targetProp.(*valueProperty); ok {
589 if !targetDesc.accessor {
590 if !targetDesc.writable && !targetDesc.configurable && !trapResult.SameAs(targetDesc.value) {
591 panic(p.val.runtime.NewTypeError("'get' on proxy: property '%s' is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value (expected '%s' but got '%s')", name.String(), nilSafe(targetDesc.value), ret))
592 }
593 } else {
594 if !targetDesc.configurable && targetDesc.getterFunc == nil && trapResult != _undefined {
595 panic(p.val.runtime.NewTypeError("'get' on proxy: property '%s' is a non-configurable accessor property on the proxy target and does not have a getter function, but the trap did not return 'undefined' (got '%s')", name.String(), ret))
596 }
597 }
598 }
599}
600
601func (p *proxyObject) getStr(name unistring.String, receiver Value) Value {
602 target := p.target

Callers 3

getStrMethod · 0.95
getIdxMethod · 0.95
getSymMethod · 0.95

Calls 4

nilSafeFunction · 0.85
NewTypeErrorMethod · 0.80
SameAsMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected