Index: runtime/vm/object.h |
=================================================================== |
--- runtime/vm/object.h (revision 38066) |
+++ runtime/vm/object.h (working copy) |
@@ -6028,6 +6028,11 @@ |
static RawArray* New(intptr_t len, Heap::Space space = Heap::kNew); |
+ // Empty array is read-only. Use only for arrays without type arguments. |
+ static RawArray* NewOrEmpty(intptr_t len, Heap::Space space = Heap::kNew) { |
+ return (len == 0) ? empty_array().raw() : New(len, space); |
+ } |
siva
2014/07/09 20:08:03
may not need this if you do the explicit checks in
|
+ |
// Creates and returns a new array with 'new_length'. Copies all elements from |
// 'source' to the new array. 'new_length' must be greater than or equal to |
// 'source.Length()'. 'source' can be null. |