jitcraft/SemanticAnalysis.cpp
changeset 11 a350c2cc736a
parent 10 0c3bcd50e361
child 12 75e385f68b7e
     1.1 --- a/jitcraft/SemanticAnalysis.cpp	Thu Jun 28 01:38:56 2012 -0700
     1.2 +++ b/jitcraft/SemanticAnalysis.cpp	Fri Jun 29 19:35:17 2012 -0700
     1.3 @@ -17,6 +17,8 @@
     1.4   */
     1.5  #include "SemanticAnalysis.h"
     1.6  #include "Types.h"
     1.7 +#include "Zone.h"
     1.8 +#include "TypeManager.h"
     1.9  
    1.10  using namespace jc;
    1.11  
    1.12 @@ -235,7 +237,7 @@
    1.13  void
    1.14  SemanticAnalysis::visit(VariableDeclaration *node)
    1.15  {
    1.16 -    Type *type = Type::NewPrimitive(node->tag());
    1.17 +    Type *type = ZONE()->types()->getPrimitiveForTag(node->tag());
    1.18      if (!type)
    1.19          return;
    1.20  
    1.21 @@ -267,7 +269,7 @@
    1.22                  }
    1.23              }
    1.24  
    1.25 -            type = Type::NewUnsafeArray(type, size);
    1.26 +            type = ZONE()->types()->unsafeArray(type, size);
    1.27          }
    1.28      } else {
    1.29          if (node->initialization()) {
    1.30 @@ -282,8 +284,7 @@
    1.31  void
    1.32  SemanticAnalysis::visit(IntegerLiteral *node)
    1.33  {
    1.34 -    Type *type = Type::NewPrimitive(NULL);
    1.35 -    node->setType(type);
    1.36 +    node->setType(ZONE()->types()->getPrimitive(PrimitiveType_Int32));
    1.37  }
    1.38  
    1.39  void
    1.40 @@ -335,7 +336,7 @@
    1.41      // :TODO: test "enum Float { ..."
    1.42      Name *tag = node->name();
    1.43  
    1.44 -    Type *type = Type::NewPrimitive(tag);
    1.45 +    Type *type = ZONE()->types()->getPrimitiveForTag(tag);
    1.46      if (!type)
    1.47          return;
    1.48  
    1.49 @@ -361,7 +362,7 @@
    1.50  void
    1.51  SemanticAnalysis::visit(FloatLiteral *node)
    1.52  {
    1.53 -    Type *type = Type::NewPrimitive(PrimitiveType_Float);
    1.54 +    Type *type = ZONE()->types()->getPrimitive(PrimitiveType_Float);
    1.55      if (!type)
    1.56          return;
    1.57