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

Method construct

proxy.go:899–910  ·  view source on GitHub ↗
(args []Value, newTarget *Object)

Source from the content-addressed store, hash-verified

897}
898
899func (p *proxyObject) construct(args []Value, newTarget *Object) *Object {
900 if p.ctor == nil {
901 panic(p.val.runtime.NewTypeError("proxy target is not a constructor"))
902 }
903 if newTarget == nil {
904 newTarget = p.val
905 }
906 if v, ok := p.checkHandler().construct(p.target, args, newTarget); ok {
907 return p.val.runtime.toObject(v)
908 }
909 return p.ctor(args, newTarget)
910}
911
912func (p *proxyObject) __isCompatibleDescriptor(extensible bool, desc *PropertyDescriptor, current *valueProperty) bool {
913 if current == nil {

Callers

nothing calls this directly

Calls 4

checkHandlerMethod · 0.95
NewTypeErrorMethod · 0.80
constructMethod · 0.65
toObjectMethod · 0.65

Tested by

no test coverage detected