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

Method pushToStringStack

builtin_array.go:168–180  ·  view source on GitHub ↗

pushToStringStack checks for circular references and pushes an object onto the toString stack. Returns true if the object is already in the stack (circular reference detected), false otherwise. If false is returned, the caller must ensure the object is popped from the stack when done.

(o *Object)

Source from the content-addressed store, hash-verified

166// Returns true if the object is already in the stack (circular reference detected), false otherwise.
167// If false is returned, the caller must ensure the object is popped from the stack when done.
168func (r *Runtime) pushToStringStack(o *Object) bool {
169 // Check for circular reference in the toString stack
170 for _, obj := range r.toStringStack {
171 if o == obj {
172 // Circular reference detected
173 return true
174 }
175 }
176
177 // Push this object onto the stack
178 r.toStringStack = append(r.toStringStack, o)
179 return false
180}
181
182// popFromStringStack removes an object from the toString stack.
183func (r *Runtime) popFromStringStack() {

Callers 2

arrayproto_joinMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected