src/Types.cpp
changeset 256 3c184218462d
parent 241 18f3010a358c
child 258 241d082d6d89
     1.1 --- a/src/Types.cpp	Tue Jan 01 20:08:34 2013 -0800
     1.2 +++ b/src/Types.cpp	Sun Jan 06 13:52:21 2013 -0800
     1.3 @@ -20,6 +20,7 @@
     1.4  #include "Types.h"
     1.5  #include "Zone.h"
     1.6  #include "Strings.h"
     1.7 +#include "Array.h"
     1.8  #include "Structures.h"
     1.9  #include "Heap-inl.h"
    1.10  
    1.11 @@ -44,6 +45,17 @@
    1.12  }
    1.13  
    1.14  Type *
    1.15 +Type::NewImportable(Zone *zone)
    1.16 +{
    1.17 +    Local<Type> type(zone, Type::cast(zone->allocate(MapKind_Type, sizeof(Type), Heap::Tenure_Old)));
    1.18 +    if (!type)
    1.19 +        return NULL;
    1.20 +
    1.21 +    type->init(IMPORTABLE);
    1.22 +    return type;
    1.23 +}
    1.24 +
    1.25 +Type *
    1.26  Type::NewString(Zone *zone)
    1.27  {
    1.28      Local<Type> type(zone, Type::cast(zone->allocate(MapKind_Type, sizeof(Type), Heap::Tenure_Old)));
    1.29 @@ -110,6 +122,11 @@
    1.30          type->levels_ = 1;
    1.31      else
    1.32          type->levels_ = ArrayType::cast(contained)->levels() + 1;
    1.33 +
    1.34 +    type->newMap_ = ArrayMap::New(zone, type);
    1.35 +    if (!type->newMap_)
    1.36 +        return NULL;
    1.37 +
    1.38      return type;
    1.39  }
    1.40  
    1.41 @@ -270,6 +287,8 @@
    1.42          return Format(buffer, maxlen, "void");
    1.43      if (type->isUnchecked())
    1.44          return Format(buffer, maxlen, "unchecked");
    1.45 +    if (type->isImportable())
    1.46 +        return Format(buffer, maxlen, "import");
    1.47      if (type->isEnum())
    1.48          return Format(buffer, maxlen, "%s", EnumType::cast(type)->name()->chars());
    1.49      if (type->isStruct())