parseh: recognize typedef types

and fix const qualifier on pointers
This commit is contained in:
Andrew Kelley
2016-01-27 16:00:43 -07:00
parent b508441859
commit 75cab48c1e
2 changed files with 25 additions and 6 deletions

View File

@@ -175,8 +175,11 @@ static Buf *type_node_to_name(AstNode *type_node) {
return &type_node->data.symbol_expr.symbol;
} else if (type_node->type == NodeTypePrefixOpExpr) {
PrefixOp op = type_node->data.prefix_op_expr.prefix_op;
const char *child_type_str = buf_ptr(type_node_to_name(type_node->data.prefix_op_expr.primary_expr));
if (op == PrefixOpAddressOf) {
return buf_sprintf("&%s", buf_ptr(type_node_to_name(type_node->data.prefix_op_expr.primary_expr)));
return buf_sprintf("&%s", child_type_str);
} else if (op == PrefixOpConstAddressOf) {
return buf_sprintf("&const %s", child_type_str);
} else {
zig_unreachable();
}