Arrays need a redimension method that lets you redistribute their elements over any number of dimensions. As implemented in SpiderMonkey, this method lets you:
Convert a non-array type T into an array type T([1])+ -- i.e., any number of dimensions, as long as they all have length 1.
Convert an array type T[...] into an array type U[...] as long as T and U are equivalent.
Note that this second test is slightly wrong: we should require that T === U to preserve aliasing guarantees (we could do T === U || (T.isTransparent() && U.isTransparent() && T.equivalent(U)), but why? you could always cast the buffer).
Arrays need a redimension method that lets you redistribute their elements over any number of dimensions. As implemented in SpiderMonkey, this method lets you:
T
into an array typeT([1])+
-- i.e., any number of dimensions, as long as they all have length 1.T[...]
into an array typeU[...]
as long asT
andU
are equivalent.Note that this second test is slightly wrong: we should require that
T === U
to preserve aliasing guarantees (we could doT === U || (T.isTransparent() && U.isTransparent() && T.equivalent(U))
, but why? you could always cast the buffer).