* NewDynamicArray creates an array Object backed by the provided DynamicArray handler. It is similar to NewDynamicObject, the differences are: - the Object is an array (i.e. Array.isArray() will return true and it will have the length property). - the prototype will be initially set to Array.proto
(a DynamicArray)
| 136 | - the Object cannot have any own string properties except for the 'length'. |
| 137 | */ |
| 138 | func (r *Runtime) NewDynamicArray(a DynamicArray) *Object { |
| 139 | v := &Object{runtime: r} |
| 140 | o := &dynamicArray{ |
| 141 | a: a, |
| 142 | baseDynamicObject: baseDynamicObject{ |
| 143 | val: v, |
| 144 | prototype: r.getArrayPrototype(), |
| 145 | }, |
| 146 | } |
| 147 | v.self = o |
| 148 | return v |
| 149 | } |
| 150 | |
| 151 | /* |
| 152 | NewSharedDynamicArray is similar to Runtime.NewDynamicArray but the resulting Object can be shared across multiple |