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

Method functionproto_toString

builtin_function.go:55–66  ·  view source on GitHub ↗
(call FunctionCall)

Source from the content-addressed store, hash-verified

53}
54
55func (r *Runtime) functionproto_toString(call FunctionCall) Value {
56 obj := r.toObject(call.This)
57 switch f := obj.self.(type) {
58 case funcObjectImpl:
59 return f.source()
60 case *proxyObject:
61 if _, ok := f.target.self.(funcObjectImpl); ok {
62 return asciiString("function () { [native code] }")
63 }
64 }
65 panic(r.NewTypeError("Function.prototype.toString requires that 'this' be a Function"))
66}
67
68func (r *Runtime) functionproto_hasInstance(call FunctionCall) Value {
69 if o, ok := call.This.(*Object); ok {

Callers

nothing calls this directly

Calls 4

toObjectMethod · 0.95
NewTypeErrorMethod · 0.95
asciiStringTypeAlias · 0.85
sourceMethod · 0.65

Tested by

no test coverage detected