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

Method setProto

proxy.go:318–333  ·  view source on GitHub ↗
(proto *Object, throw bool)

Source from the content-addressed store, hash-verified

316}
317
318func (p *proxyObject) setProto(proto *Object, throw bool) bool {
319 target := p.target
320 if v, ok := p.checkHandler().setPrototypeOf(target, proto); ok {
321 if v {
322 if !target.self.isExtensible() && !p.__sameValue(proto, target.self.proto()) {
323 panic(p.val.runtime.NewTypeError("'setPrototypeOf' on proxy: trap returned truish for setting a new prototype on the non-extensible proxy target"))
324 }
325 return true
326 } else {
327 p.val.runtime.typeErrorResult(throw, "'setPrototypeOf' on proxy: trap returned falsish")
328 return false
329 }
330 }
331
332 return target.self.setProto(proto, throw)
333}
334
335func (p *proxyObject) isExtensible() bool {
336 target := p.target

Callers

nothing calls this directly

Calls 8

checkHandlerMethod · 0.95
__sameValueMethod · 0.95
NewTypeErrorMethod · 0.80
typeErrorResultMethod · 0.80
setPrototypeOfMethod · 0.65
isExtensibleMethod · 0.65
protoMethod · 0.65
setProtoMethod · 0.65

Tested by

no test coverage detected