()
| 228 | } |
| 229 | |
| 230 | func createFunctionProtoTemplate() *objectTemplate { |
| 231 | t := newObjectTemplate() |
| 232 | t.protoFactory = func(r *Runtime) *Object { |
| 233 | return r.global.ObjectPrototype |
| 234 | } |
| 235 | |
| 236 | t.putStr("constructor", func(r *Runtime) Value { return valueProp(r.getFunction(), true, false, true) }) |
| 237 | |
| 238 | t.putStr("length", func(r *Runtime) Value { return valueProp(_positiveZero, false, false, true) }) |
| 239 | t.putStr("name", func(r *Runtime) Value { return valueProp(stringEmpty, false, false, true) }) |
| 240 | |
| 241 | t.putStr("apply", func(r *Runtime) Value { return r.methodProp(r.functionproto_apply, "apply", 2) }) |
| 242 | t.putStr("bind", func(r *Runtime) Value { return r.methodProp(r.functionproto_bind, "bind", 1) }) |
| 243 | t.putStr("call", func(r *Runtime) Value { return r.methodProp(r.functionproto_call, "call", 1) }) |
| 244 | t.putStr("toString", func(r *Runtime) Value { return r.methodProp(r.functionproto_toString, "toString", 0) }) |
| 245 | |
| 246 | t.putStr("caller", func(r *Runtime) Value { return r.newThrowerProperty(true) }) |
| 247 | t.putStr("arguments", func(r *Runtime) Value { return r.newThrowerProperty(true) }) |
| 248 | |
| 249 | t.putSym(SymHasInstance, func(r *Runtime) Value { |
| 250 | return valueProp(r.newNativeFunc(r.functionproto_hasInstance, "[Symbol.hasInstance]", 1), false, false, false) |
| 251 | }) |
| 252 | |
| 253 | return t |
| 254 | } |
| 255 | |
| 256 | var functionProtoTemplate *objectTemplate |
| 257 | var functionProtoTemplateOnce sync.Once |
no test coverage detected
searching dependent graphs…