src/Structures.cpp
changeset 241 18f3010a358c
parent 234 26e3035cdffc
child 256 3c184218462d
     1.1 --- a/src/Structures.cpp	Tue Dec 25 18:13:02 2012 -0800
     1.2 +++ b/src/Structures.cpp	Wed Dec 26 17:14:12 2012 -0800
     1.3 @@ -133,14 +133,16 @@
     1.4                  childStructMap = StructMap::cast(StructType::cast(desc->type())->newMap());
     1.5                  child = Struct::New(zone, childStructMap, tenure);
     1.6              } else if (desc->type()->isArray()) {
     1.7 -                assert(false);
     1.8 -#if 0
     1.9 -                childArrayMap = ArrayMap::cast(desc->type()->newMap());
    1.10 -                if (desc->type()->isFixedLength())
    1.11 +                // :TODO: don't create empty arrays for ref slots here.
    1.12 +                // Instead, make a separate Initialize function, so we
    1.13 +                // can avoid double-creating arrays for module globals.
    1.14 +                //  (const char:x[] = "x")
    1.15 +                ArrayType *type = ArrayType::cast(desc->type());
    1.16 +                childArrayMap = ArrayMap::cast(type->newMap());
    1.17 +                if (type->isFixedLength())
    1.18                      child = Array::NewFixed(zone, childArrayMap, tenure);
    1.19                  else
    1.20                      child = Array::NewEmpty(zone, childArrayMap, tenure);
    1.21 -#endif
    1.22              }
    1.23              if (!child)
    1.24                  return NULL;