src/Types.cpp
changeset 240 e3c851a14f16
parent 239 572668ef742b
child 241 18f3010a358c
     1.1 --- a/src/Types.cpp	Tue Dec 25 17:02:07 2012 -0800
     1.2 +++ b/src/Types.cpp	Tue Dec 25 18:13:02 2012 -0800
     1.3 @@ -26,10 +26,10 @@
     1.4  using namespace ke;
     1.5  
     1.6  void
     1.7 -Type::init(Kind kind)
     1.8 +Type::init(Kind kind, Type *root)
     1.9  {
    1.10      this->kind_ = kind;
    1.11 -    this->root_ = this;
    1.12 +    this->root_ = root ? root : this;
    1.13  }
    1.14  
    1.15  Type *
    1.16 @@ -77,6 +77,18 @@
    1.17      return type;
    1.18  }
    1.19  
    1.20 +Type *
    1.21 +Type::NewQualified(Zone *zone, TypeQualifiers qual, Handle<Type> root)
    1.22 +{
    1.23 +    Local<Type> type(zone, Type::cast(zone->allocate(MapKind_Type, sizeof(Type), Heap::Tenure_Old)));
    1.24 +    if (!type)
    1.25 +        return NULL;
    1.26 +
    1.27 +    type->init(QUALTYPE, root);
    1.28 +    type->quals_ = qual;
    1.29 +    return type;
    1.30 +}
    1.31 +
    1.32  ArrayType *
    1.33  ArrayType::New(Zone *zone, Handle<Type> contained, int elements)
    1.34  {
    1.35 @@ -235,4 +247,3 @@
    1.36          return "<unknown>";
    1.37      }
    1.38  }
    1.39 -