WONKY



LOG | FILES | OVERVIEW


F diff --git a/src/frontend/parse/parse_declaration.c b/src/frontend/parse/parse_declaration.c --- a/src/frontend/parse/parse_declaration.c +++ b/src/frontend/parse/parse_declaration.c
if(hold->denotation==DT_Function)
{
+ Scope_Push(scope,hold,translation_data);
/*check if this is a function definition*/
if(parse_function_definitions && get_and_check(translation_data,KW_OPEN_CURLY))
{
((struct Denoted_Function*)hold) ->body=
(struct AST_Compound_Statement*)parse_finish_compound_statement(translation_data,(struct Scope*)function_type->function_prototype_scope);
Queue_Push(where_to_push,get_function_definition_tree(scope,(struct Denoted_Function*)hold));
- Scope_Push(scope,hold,translation_data);
break;
}
/*this is a function declaration*/
F diff --git a/src/frontend/parse/parse_expression.c b/src/frontend/parse/parse_expression.c --- a/src/frontend/parse/parse_expression.c +++ b/src/frontend/parse/parse_expression.c
hold_postfix_expression=parse_primary_expression(translation_data,scope);
- while(translation_data->tokens->size!=0)
+ while(translation_data->tokens->size!=0 && hold_postfix_expression!=NULL)
{
switch(kw_get(translation_data))
{
F diff --git a/src/semantics/ast.c b/src/semantics/ast.c --- a/src/semantics/ast.c +++ b/src/semantics/ast.c
);
}
+ struct AST_Expression* get_degraded_array_expression_if_it_has_the_right_type(struct AST_Expression *expression,struct Translation_Data *translation_data)
+ {
+ struct Type *expression_type;
+ struct Type_Array *array_type;
+
+ expression_type=extract_expresion_value_type(expression->value,translation_data);
+ if(expression_type->specifier==TS_ARRAY)
+ {
+ array_type=(struct Type_Array*)expression_type;
+ expression_type=get_pointer_type(array_type->is_array_of,1,0);
+
+ assert(expression_type!=NULL);
+
+ return get_cast_expression_tree(expression,expression_type,translation_data);
+ }else
+ {
+ return expression;
+ }
+ }
/*
* it finds the common real type of the operands then 'upgrades' them
struct Type_Basic *right_type;
struct Expression_Value *value;
+ left=get_degraded_array_expression_if_it_has_the_right_type(left,translation_data);
+ right=get_degraded_array_expression_if_it_has_the_right_type(right,translation_data);
+
left=get_promoted_expression(left,translation_data);
right=get_promoted_expression(right,translation_data);
struct Type *left_type;
struct Type *member_type;
+ left=get_degraded_array_expression_if_it_has_the_right_type(left,translation_data);
+ right=get_degraded_array_expression_if_it_has_the_right_type(right,translation_data);
+
left_type=extract_expresion_value_type(left->value,translation_data);
if(left_type->specifier!=TS_POINTER)
{push_translation_error("expected pointer in array subscript",translation_data);return NULL;}
struct AST_Unary_Expression* get_postfix_inc_dec_tree(struct AST_Expression *operand,enum AST_Type operation,struct Translation_Data *translation_data)
{
struct Type *operand_type;
+ operand=get_degraded_array_expression_if_it_has_the_right_type(operand,translation_data);
operand_type=extract_expresion_value_type(operand->value,translation_data);
if(constraint_check_postfix_inc_dec_expression(operand,operation,translation_data))
{
struct AST_Unary_Expression* get_prefix_inc_dec_tree(struct AST_Expression *operand,enum AST_Type operation,struct Translation_Data *translation_data)
{
struct Type *operand_type;
+ operand=get_degraded_array_expression_if_it_has_the_right_type(operand,translation_data);
operand_type=extract_expresion_value_type(operand->value,translation_data);
if(constraint_check_prefix_inc_dec_expression(operand,operation,translation_data))
{
F diff --git a/src/semantics/ast.h b/src/semantics/ast.h --- a/src/semantics/ast.h +++ b/src/semantics/ast.h
struct AST_Expression* get_cast_expression_tree(struct AST_Expression *operand,struct Type *type,struct Translation_Data *translation_data);
+ struct AST_Expression* get_degraded_array_expression_if_it_has_the_right_type(struct AST_Expression *expression,struct Translation_Data *translation_data);
struct AST_Binary_Expression* get_binary_expression_after_conversion(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type type,struct Translation_Data *translation_data);
struct AST_Binary_Expression* get_binary_expression_tree(struct AST_Expression *left,struct AST_Expression *right,struct Expression_Value *value,enum AST_Type type);
struct AST_Binary_Expression* get_modulo_tree(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data);