Encode the basic type for functions, fields and pointers.

Very important for distinguishing them from other types.
This commit is contained in:
Bill Currie 2011-02-27 00:33:16 +09:00
parent 55043310fc
commit 4f6d18a328
2 changed files with 6 additions and 2 deletions

View file

@ -44,10 +44,12 @@
#include "type.h"
typedef struct qfot_ptrfld_s {
pointer_t type; ///< referenced type
pr_int_t type; ///< ev_field or ev_pointer
pointer_t aux_type; ///< referenced type
} qfot_ptrfld_t;
typedef struct qfot_func_s {
pr_int_t type; ///< always ev_func
pointer_t return_type; ///< return type of the function
pr_int_t num_params; ///< ones compliment count of the
///< parameters. -ve values indicate the

View file

@ -119,6 +119,7 @@ qfo_encode_func (type_t *type)
def = qfo_new_encoding (type, size);
enc = D_POINTER (qfot_type_t, def);
func = &enc->t.func;
func->type = ev_func;
ENC_DEF (func->return_type, return_type_def);
func->num_params = type->t.func.num_params;
for (i = 0; i < param_count; i++)
@ -136,7 +137,8 @@ qfo_encode_ptrfld (type_t *type)
type_def = qfo_encode_type (type->t.fldptr.type);
def = qfo_new_encoding (type, sizeof (enc->t.ptrfld));
enc = D_POINTER (qfot_type_t, def);
ENC_DEF (enc->t.ptrfld.type, type_def);
enc->t.ptrfld.type = type->type;
ENC_DEF (enc->t.ptrfld.aux_type, type_def);
return def;
}