From 2d681e7fa8160d6bea46601d066dab4442c3befa Mon Sep 17 00:00:00 2001 From: gambas Date: Sat, 19 Feb 2022 11:30:28 +0100 Subject: [PATCH] Type analysis of bit operators now works correctly. [COMPILER] * BUG: Type analysis of bit operators now works correctly. --- main/gbc/gbc_trans_expr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main/gbc/gbc_trans_expr.c b/main/gbc/gbc_trans_expr.c index 6b393fc34..ee71aff3d 100644 --- a/main/gbc/gbc_trans_expr.c +++ b/main/gbc/gbc_trans_expr.c @@ -72,7 +72,8 @@ static void _drop_type(int n) #define push_type_id(_id) fprintf(stderr, "push_type_id: %d in %s.%d\n", (_id), __func__, __LINE__), _push_type(TYPE_make_simple(_id)) #define pop_type() (fprintf(stderr, "pop_type: in %s.%d\n", __func__, __LINE__),(_type[--_type_level])) #define drop_type(_n) fprintf(stderr, "drop_type: %d in %s.%d\n", (_n), __func__, __LINE__),_drop_type(_n) -#define get_type_id(_i, _nparam) (fprintf(stderr, "get_type(%d,%d): %d in %s.%d\n", (_i), (_nparam), (_type[_type_level + (_i) - (_nparam)].t.id), __func__, __LINE__),(_type[_type_level + (_i) - (_nparam)].t.id)) +#define get_type(_i, _nparam) (fprintf(stderr, "get_type(%d,%d): %d in %s.%d\n", (_i), (_nparam), (_type[_type_level + (_i) - (_nparam)].l), __func__, __LINE__),(_type[_type_level + (_i) - (_nparam)])) +#define get_type_id(_i, _nparam) (fprintf(stderr, "get_type_id(%d,%d): %d in %s.%d\n", (_i), (_nparam), (_type[_type_level + (_i) - (_nparam)].t.id), __func__, __LINE__),(_type[_type_level + (_i) - (_nparam)].t.id)) #define dup_type() fprintf(stderr, "dup_type: in %s.%d\n", __func__, __LINE__),push_type(_type[_type_level - 1]) #else @@ -557,6 +558,10 @@ static void trans_operation(short op, short nparam, PATTERN previous) ftype = TYPE_make_simple(T_VARIANT); break; + case RST_BCLR: + ftype = get_type(0, nparam); + break; + /*case RST_GET: ftype = get_type(0, nparam); if (ftype.t.id == T_OBJECT) @@ -572,6 +577,8 @@ static void trans_operation(short op, short nparam, PATTERN previous) break;*/ default: + if (type > T_OBJECT) + ERROR_panic("Operator type analysis not implemented."); ftype = TYPE_make_simple(type); }