Type * TypeCheck::visit(PrimaryExpression *ast) { FUNCLOG; //Type * t; switch (ast->op) { case PRIMARY_ID: { ScopedId *scopedId = ast->v.id; if (scopedId->scope) { //TODO: } UnqualifiedId *unqualifiedId = scopedId->id; String s = unqualifiedId->toSource(); Type *t = SymbolTable.findVar(Symbol::symbol(s)); if (!t) { SEMANTIC_ERROR(SE_UNDEFINED_SYMBOL); } return t; } case PRIMARY_INT: { IntType *itype = new IntType(32, true); if (ast->v.i == 0) { itype->setNullable(true); } return itype; } case PRIMARY_BOOL: return new IntType(8, false); case PRIMARY_STR: { PointerType *ptrType = new PointerType(); ptrType->reference = new IntType(8, true); DBG("$$ %s", ptrType->toString().c_str()); return ptrType; } case PRIMARY_EXP: return ast->v.exp->accept(this); default: assert(0); break; } return NULL; }