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

Method defineOwnPropertyStr

object_template.go:228–240  ·  view source on GitHub ↗
(name unistring.String, descr PropertyDescriptor, throw bool)

Source from the content-addressed store, hash-verified

226}
227
228func (o *templatedObject) defineOwnPropertyStr(name unistring.String, descr PropertyDescriptor, throw bool) bool {
229 existingVal := o.getOwnPropStr(name)
230 if v, ok := o._defineOwnProperty(name, existingVal, descr, throw); ok {
231 o.values[name] = v
232 if existingVal == nil {
233 o.materialisePropNames()
234 names := copyNamesIfNeeded(o.propNames, 1)
235 o.propNames = append(names, name)
236 }
237 return true
238 }
239 return false
240}
241
242func (o *templatedObject) defineOwnPropertySym(s *Symbol, descr PropertyDescriptor, throw bool) bool {
243 o.materialiseSymbols()

Callers 1

Calls 4

getOwnPropStrMethod · 0.95
materialisePropNamesMethod · 0.95
copyNamesIfNeededFunction · 0.85
_defineOwnPropertyMethod · 0.80

Tested by

no test coverage detected