Evaluate member accesses.

This commit is contained in:
Roberto Raggi
2010-11-29 18:16:44 +01:00
parent 55234b9d16
commit 945b25559d

View File

@@ -248,7 +248,19 @@ bool Semantic::visit(AssignmentExpressionAST *ast)
bool Semantic::visit(MemberAccessExpressionAST *ast)
{
ExprResult expr = expression(ast->expr);
// ast->field
if (expr.type && ast->field) {
if (const VectorType *vecTy = expr.type->asVectorType()) {
if (Symbol *s = vecTy->find(*ast->field)) {
_expr.type = s->type();
}
} else if (const Struct *structTy = expr.type->asStructType()) {
if (Symbol *s = structTy->find(*ast->field)) {
_expr.type = s->type();
}
} else {
// error(ast->lineno, QString("Requested for member `%1', in a non class or vec instance").arg(*ast->field));
}
}
return false;
}