summaryrefslogtreecommitdiff
path: root/type-check.c
diff options
context:
space:
mode:
authorSøren Sandmann <sandmann@redhat.com>2007-10-17 02:39:15 -0400
committerSøren Sandmann <sandmann@redhat.com>2007-10-17 02:39:15 -0400
commit642ac5bd670996cbef8754270e60a7219d546ed2 (patch)
tree4523f367c3f3c3ed371679a86a00ac35017107a1 /type-check.c
parentaf2c5e716c246bbd7ce7091b7af5b5230e27c366 (diff)
Resolve type in a bunch of places
Diffstat (limited to 'type-check.c')
-rw-r--r--type-check.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/type-check.c b/type-check.c
index ee954e5..9ee3af1 100644
--- a/type-check.c
+++ b/type-check.c
@@ -27,6 +27,12 @@
* Various helpers
*/
static ast_type_spec_t *
+resolve (const ast_type_spec_t *type)
+{
+ return ast_type_spec_resolve (type);
+}
+
+static ast_type_spec_t *
new_int32 (void)
{
return ast_type_spec_new (AST_INT32_TYPE);
@@ -47,31 +53,31 @@ new_bool (void)
static gboolean
is_bool (ast_type_spec_t *type)
{
- return type->common.type == AST_BOOL_TYPE;
+ return resolve (type)->common.type == AST_BOOL_TYPE;
}
static gboolean
is_null (ast_type_spec_t *type)
{
- return type->common.type == AST_NULL_TYPE;
+ return resolve (type)->common.type == AST_NULL_TYPE;
}
static gboolean
is_int32 (ast_type_spec_t *type)
{
- return type->common.type == AST_INT32_TYPE;
+ return resolve (type)->common.type == AST_INT32_TYPE;
}
static gboolean
is_void (ast_type_spec_t *type)
{
- return type->common.type == AST_VOID_TYPE;
+ return resolve (type)->common.type == AST_VOID_TYPE;
}
static gboolean
is_function (ast_type_spec_t *type)
{
- return type->common.type == AST_FUNCTION_TYPE;
+ return resolve (type)->common.type == AST_FUNCTION_TYPE;
}
static gboolean
@@ -95,8 +101,8 @@ promote_numeric (const ast_type_spec_t *left,
{
ast_type_spec_type_t new_type;
- if (left->common.type == AST_DOUBLE_TYPE ||
- right->common.type == AST_DOUBLE_TYPE)
+ if (resolve (left)->common.type == AST_DOUBLE_TYPE ||
+ resolve (right)->common.type == AST_DOUBLE_TYPE)
{
new_type = AST_DOUBLE_TYPE;
}
@@ -159,9 +165,7 @@ is_class (ast_type_spec_t *type)
{
g_return_val_if_fail (type != NULL, FALSE);
- type = ast_type_spec_resolve (type);
-
- return type->common.type == AST_OBJECT_TYPE;
+ return resolve(type)->common.type == AST_OBJECT_TYPE;
}
static gboolean
@@ -169,7 +173,7 @@ is_array (ast_type_spec_t *type)
{
type = ast_type_spec_resolve (type);
- return type->common.type == AST_ARRAY_TYPE;
+ return resolve(type)->common.type == AST_ARRAY_TYPE;
}
static gboolean