1.1 --- a/src/Types.h Sat Jan 12 16:35:26 2013 -0800
1.2 +++ b/src/Types.h Sun Jan 27 17:34:30 2013 -0800
1.3 @@ -65,7 +65,11 @@
1.4 TypeQual_None = 0,
1.5
1.6 // Values of this type cannot be modified.
1.7 - TypeQual_Const = (1 << 2)
1.8 + TypeQual_Const = (1 << 0),
1.9 +
1.10 + // Values of this type can be treated as constant expressions. This allows
1.11 + // us to export compile-time constants from modules.
1.12 + TypeQual_ConstExpr = (1 << 1)
1.13 };
1.14
1.15 class Type : public Object
1.16 @@ -115,7 +119,10 @@
1.17
1.18 // Importable types are mainly used during the compilation process
1.19 // to distinguish between normal names and static imports.
1.20 - IMPORTABLE
1.21 + IMPORTABLE,
1.22 +
1.23 + // The type of types.
1.24 + TYPE
1.25 };
1.26
1.27 void init(Kind kind, Type *root = NULL);
1.28 @@ -128,6 +135,7 @@
1.29 public:
1.30 static Type *NewVoid(Zone *zone);
1.31 static Type *NewUnchecked(Zone *zone);
1.32 + static Type *NewType(Zone *zone);
1.33 static Type *NewPrimitive(Zone *zone, PrimitiveType type);
1.34 static Type *NewString(Zone *zone);
1.35 static Type *NewQualified(Zone *zone, TypeQualifiers qual, Handle<Type> type);
1.36 @@ -210,6 +218,9 @@
1.37 bool isEnum() {
1.38 return kind() == ENUM;
1.39 }
1.40 + bool isType() {
1.41 + return kind() == TYPE;
1.42 + }
1.43 bool hasTypeQualifiers() {
1.44 return kind_ == QUALTYPE;
1.45 }
1.46 @@ -252,6 +263,9 @@
1.47 static inline size_t offsetOfName() {
1.48 return OFFSETOF(EnumType, name_);
1.49 }
1.50 + static inline size_t offsetOfFields() {
1.51 + return OFFSETOF(EnumType, fields_);
1.52 + }
1.53 // End GC Descriptor.
1.54
1.55 static EnumType *cast(Object *obj) {
1.56 @@ -261,6 +275,7 @@
1.57
1.58 private:
1.59 Barriered<String> name_;
1.60 + Barriered<FixedArray> fields_;
1.61 };
1.62
1.63 class ReferenceType : public Type