src/Array.cpp
changeset 209 5cbec15fadfe
parent 188 bab29bcec7fe
child 234 26e3035cdffc
     1.1 --- a/src/Array.cpp	Sat Nov 17 22:02:08 2012 -0800
     1.2 +++ b/src/Array.cpp	Sat Nov 17 23:11:38 2012 -0800
     1.3 @@ -27,7 +27,7 @@
     1.4  using namespace ke;
     1.5  
     1.6  ArrayMap *
     1.7 -ArrayMap::New(Zone *zone, Handle<Type> type)
     1.8 +ArrayMap::New(Zone *zone, Handle<ArrayType> type)
     1.9  {
    1.10      Local<Map> obj(zone, zone->allocateMap(MapKind_Array, sizeof(ArrayMap), MapKind_MetaArray));
    1.11      if (!obj)
    1.12 @@ -39,7 +39,7 @@
    1.13  }
    1.14  
    1.15  ArrayMap *
    1.16 -ArrayMap::Attach(Zone *zone, Handle<Type> type)
    1.17 +ArrayMap::Attach(Zone *zone, Handle<ArrayType> type)
    1.18  {
    1.19      if (type->newMap())
    1.20          return ArrayMap::cast(type->newMap());
    1.21 @@ -50,7 +50,7 @@
    1.22  
    1.23      // Ensure the inner type has an ArrayMap if needed.
    1.24      if (type->contained()->isArray()) {
    1.25 -        Local<Type> contained(zone, type->contained());
    1.26 +        Local<ArrayType> contained(zone, ArrayType::cast(type->contained()));
    1.27          if (!ArrayMap::Attach(zone, contained))
    1.28              return NULL;
    1.29      }
    1.30 @@ -114,7 +114,8 @@
    1.31  
    1.32      // If this is an array of structs, we're required to allocate those structs now.
    1.33      if (map->type()->contained()->isStruct()) {
    1.34 -        Local<StructMap> childMap(zone, StructMap::cast(map->type()->contained()->newMap()));
    1.35 +        Local<StructType> childType(zone, StructType::cast(map->type()->contained()));
    1.36 +        Local<StructMap> childMap(zone, childType->newMap());
    1.37          Local<Struct> child(zone);
    1.38          for (unsigned i = 0; i < nelements; i++) {
    1.39              child = Struct::New(zone, childMap, tenure);
    1.40 @@ -137,7 +138,8 @@
    1.41          return NULL;
    1.42  
    1.43      if (map->type()->contained()->isArray()) {
    1.44 -        Local<ArrayMap> childMap(zone, ArrayMap::cast(map->type()->contained()->newMap()));
    1.45 +        Local<ArrayType> childType(zone, ArrayType::cast(map->type()->contained()));
    1.46 +        Local<ArrayMap> childMap(zone, childType->newMap());
    1.47          Local<Array> child(zone);
    1.48  
    1.49          for (unsigned i = 0; i < unsigned(dims[level]); i++) {
    1.50 @@ -174,7 +176,8 @@
    1.51          return NULL;
    1.52  
    1.53      if (map->type()->contained()->isArray()) {
    1.54 -        Local<ArrayMap> childMap(zone, ArrayMap::cast(map->type()->contained()->newMap()));
    1.55 +        Local<ArrayType> childType(zone, ArrayType::cast(map->type()->contained()));
    1.56 +        Local<ArrayMap> childMap(zone, childType->newMap());
    1.57          Local<Array> child(zone);
    1.58  
    1.59          if (childMap->type()->isFixedLength()) {