jitcraft/Types.cpp
changeset 4 633176823669
parent 3 f43e399ab622
child 11 a350c2cc736a
     1.1 --- a/jitcraft/Types.cpp	Tue Jun 26 00:58:55 2012 -0700
     1.2 +++ b/jitcraft/Types.cpp	Wed Jun 27 02:21:56 2012 -0700
     1.3 @@ -19,19 +19,27 @@
     1.4  
     1.5  using namespace jc;
     1.6  
     1.7 -Tag::Tag(Name *name)
     1.8 -  : name_(name)
     1.9 -{
    1.10 -}
    1.11 -
    1.12  Type *
    1.13 -Type::NewPrimitive(Tag *tag)
    1.14 +Type::NewPrimitive(Name *tag)
    1.15  {
    1.16      Type *type = new Type;
    1.17      type->kind_ = PRIMITIVE;
    1.18      type->tag_ = tag;
    1.19      
    1.20 -    type->primitive_ = PrimitiveType_Int32;
    1.21 +    if (tag && strcmp(tag, "Float") == 0)
    1.22 +        type->primitive_ = PrimitiveType_Float;
    1.23 +    else
    1.24 +        type->primitive_ = PrimitiveType_Int32;
    1.25 +    return type;
    1.26 +}
    1.27 +
    1.28 +Type *
    1.29 +Type::NewPrimitive(PrimitiveType prim)
    1.30 +{
    1.31 +    Type *type = new Type;
    1.32 +    type->kind_ = PRIMITIVE;
    1.33 +    type->tag_ = NULL;
    1.34 +    type->primitive_ = prim;
    1.35      return type;
    1.36  }
    1.37