diff -r a8735148dcf0 -r e9d804821c48 src/TypeManager.cpp --- a/src/TypeManager.cpp Mon Jul 30 22:30:38 2012 -0700 +++ b/src/TypeManager.cpp Wed Aug 01 22:32:59 2012 -0700 @@ -39,29 +39,15 @@ if (!voidType_) return false; - Local floatTag(zone_, zone_->makeSymbol("Float")); - if (!floatTag) - return false; - - Local stringTag(zone_, zone_->makeSymbol("String")); - if (!stringTag) + if ((primitiveTypes_[PrimitiveType_Int32] = Type::NewPrimitive(zone_, PrimitiveType_Int32)) == NULL) return false; - - Local boolTag(zone_, zone_->makeSymbol("bool")); - if (!boolTag) - return false; - - Local nullTag(zone_); - - if ((primitiveTypes_[PrimitiveType_Int32] = Type::NewPrimitive(zone_, nullTag)) == NULL) - return false; - if ((primitiveTypes_[PrimitiveType_Float] = Type::NewPrimitive(zone_, floatTag)) == NULL) + if ((primitiveTypes_[PrimitiveType_Float] = Type::NewPrimitive(zone_, PrimitiveType_Float)) == NULL) return false; if ((primitiveTypes_[PrimitiveType_Native] = Type::NewPrimitive(zone_, PrimitiveType_Native)) == NULL) return false; - if ((primitiveTypes_[PrimitiveType_Char] = Type::NewPrimitive(zone_, stringTag)) == NULL) + if ((primitiveTypes_[PrimitiveType_Char] = Type::NewPrimitive(zone_, PrimitiveType_Char)) == NULL) return false; - if ((primitiveTypes_[PrimitiveType_Bool] = Type::NewPrimitive(zone_, boolTag)) == NULL) + if ((primitiveTypes_[PrimitiveType_Bool] = Type::NewPrimitive(zone_, PrimitiveType_Bool)) == NULL) return false; Local type(zone_); @@ -75,20 +61,6 @@ } Type * -TypeManager::getPrimitiveForTag(Handle tag) -{ - if (!tag || strcmp(tag->chars(), "_") == 0) - return getPrimitive(PrimitiveType_Int32); - if (strcmp(tag->chars(), "Float") == 0) - return getPrimitive(PrimitiveType_Float); - if (strcmp(tag->chars(), "String") == 0) - return getPrimitive(PrimitiveType_Char); - - // :TODO: cache this. - return Type::NewPrimitive(zone_, tag); -} - -Type * TypeManager::unsafeArray(Handle contained, int elements, bool isConst) { // :TODO: cache this. @@ -98,7 +70,7 @@ Type * TypeManager::getReference(Handle type, bool isConst) { - if (!isConst && (type->isFloat() || (type->isInt32() && !type->tag()))) + if (!isConst && type->isPrimitive()) return referenceTypes_[type->primitive()]; // :TODO: cache this. @@ -119,6 +91,12 @@ return Type::NewNative(zone_, returnType, args, variadic); } +Type * +TypeManager::newEnum(Handle name) +{ + return Type::NewEnum(zone_, name); +} + void TypeManager::accept(VirtualObjectVisitor *visitor) {