From da07704c2037b6f9566a378eacf8381e5f5c9ba5 Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Thu, 22 Jul 2010 16:17:31 -0700 Subject: inspect: cast expression Adding cast expression for AST inspecting. Signed-off-by: Christopher Li --- ast-inspect.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ast-inspect.c b/ast-inspect.c index 293334e..5363de3 100644 --- a/ast-inspect.c +++ b/ast-inspect.c @@ -66,6 +66,12 @@ void inspect_statement(AstNode *node) ast_append_child(node, "post_statement:", stmt->iterator_post_statement, inspect_statement); break; + + case STMT_RETURN: + ast_append_child(node, "ret_value:", stmt->ret_value, inspect_expression); + ast_append_child(node, "ret_target:", stmt->ret_target, inspect_symbol); + break; + default: break; } @@ -109,7 +115,7 @@ void inspect_symbol(AstNode *node) { struct symbol *sym = node->ptr; node->text = g_strdup_printf("%s %s: %s", node->text, symbol_type_name(sym->type), - show_ident(sym->ident)); + builtin_typename(sym) ?: show_ident(sym->ident)); ast_append_child(node, "ctype.base_type:", sym->ctype.base_type,inspect_symbol); switch (sym->type) { @@ -181,6 +187,18 @@ void inspect_expression(AstNode *node) ast_append_child(node, "left:", expr->left, inspect_expression); ast_append_child(node, "right:", expr->right, inspect_expression); break; + + case EXPR_CAST: + case EXPR_FORCE_CAST: + case EXPR_IMPLIED_CAST: + ast_append_child(node, "cast_type:", expr->cast_type, inspect_symbol); + ast_append_child(node, "cast_expression:", expr->cast_expression, inspect_expression); + break; + + case EXPR_PREOP: + ast_append_child(node, "unop:", expr->unop, inspect_expression); + break; + default: break; } -- cgit v1.2.3-65-gdbad