//TODO XXX ASTType *DotExpression::getType() { if(rhs == "sizeof" || rhs == "offsetof") { return ASTType::getLongTy(); } ASTType *lhstype = lhs->getType(); if(rhs == "ptr" && lhstype->isArray()) { return lhstype->asArray()->arrayOf->getPointerTy(); } if(rhs == "size" && lhstype->isArray()) { return ASTType::getLongTy(); } //if type is pointer, implicit dereference on dot expression if(lhstype->asPointer()) { lhstype = lhstype->asPointer()->ptrTo; } if(ASTUserType *uty = lhstype->asUserType()) { Identifier *dotid = uty->getDeclaration()->lookup(rhs); if(dotid) return dotid->getType(); } return NULL; }
virtual ASTType *getType() { return id->getType(); }