typecheck values for [frame, think] on thost functions and fix some misplaced

immediate defs
This commit is contained in:
Bill Currie 2001-07-24 23:53:35 +00:00
parent 9ad075b02e
commit 620063628c
3 changed files with 11 additions and 3 deletions

View file

@ -66,6 +66,8 @@ expr_t *append_expr (expr_t *block, expr_t *e);
void print_expr (expr_t *e);
void convert_int (expr_t *e);
expr_t *test_expr (expr_t *e, int test);
expr_t *binary_expr (int op, expr_t *e1, expr_t *e2);
expr_t *unary_expr (int op, expr_t *e);

View file

@ -188,17 +188,17 @@ PR_ReuseConstant (expr_t *expr, def_t *def)
switch (e.type) {
case ex_entity:
sprintf (rep, "\001entity:%08X\001", e.e.integer_val);
tab = float_imm_defs;
tab = entity_imm_defs;
type = &type_entity;
break;
case ex_field:
sprintf (rep, "\001field:%08X\001", e.e.integer_val);
tab = float_imm_defs;
tab = field_imm_defs;
type = &type_field;
break;
case ex_func:
sprintf (rep, "\001func:%08X\001", e.e.integer_val);
tab = float_imm_defs;
tab = func_imm_defs;
type = &type_function;
break;
case ex_pointer:

View file

@ -246,6 +246,12 @@ opt_initializer
}
']'
{
if ($3->type == ex_integer)
convert_int ($3);
if ($3->type != ex_float)
error ($3, "invalid type for frame number");
if ($6->type->type != ev_func)
error ($3, "invalid type for think");
$<expr>$ = new_expr ();
}
begin_function statement_block end_function