F diff --git a/src/semantics/ast.c b/src/semantics/ast.c
--- a/src/semantics/ast.c
+++ b/src/semantics/ast.c
return ret;
}
+ /*TODO beware const type qualifier*/
struct AST_Binary_Expression* get_struct_union_member_trough_ptr_tree(struct AST_Expression *left,struct token *id,struct Translation_Data *translation_data)
{
struct Type *left_type;
+ struct Type_Struct_Union *struct_union_type;
left_type=extract_expresion_value_type(left->value,translation_data);
if(left_type->specifier!=TS_POINTER)
- {push_translation_error("expected pointer in member trough ptr acess",translation_data);return NULL;}
- left_type=left_type->points_to;
- if(type_is_character
+ {push_translation_error("expected pointer in member trough ptr access",translation_data);return NULL;}
+ struct_union_type=left_type->points_to;
+ if(type_is_struct_union(struct_union_type))
+ {push_translation_error("expected pointer to struct or union in member trough ptr access",translation_data);return NULL;}
+
+ struct_union_type->struct_union->inner_namespace
+
}
struct AST_Conditional_Expression* get_conditional_expression_tree(struct AST_Expression *left,struct AST_Expression *center,struct AST_Expression *right)
F diff --git a/src/semantics/value/type.c b/src/semantics/value/type.c
--- a/src/semantics/value/type.c
+++ b/src/semantics/value/type.c
{
return (type->specifier==TS_ARRAY || type->specifier==TS_UNION || type->specifier==TS_STRUCT);
}
+ char type_is_struct_union(struct Type *type)
+ {
+ return (type->specifier==TS_STRUCT || type->specifier==TS_UNION);
+ }
#endif
F diff --git a/src/semantics/value/type.h b/src/semantics/value/type.h
--- a/src/semantics/value/type.h
+++ b/src/semantics/value/type.h
struct Queue *members;
struct Normal_Scope *inner_namespace;
- char is_finished;
+ char is_finished:1;
+ char has_constant_member:1;
};
struct Type_Bit_Field
{
char type_is_arithmetic(struct Type *type);
char type_is_scalar(struct Type *type);
char type_is_aggregate(struct Type *type);
+ char type_is_struct_union(struct Type *type);
F diff --git a/src/semantics/value/value.c b/src/semantics/value/value.c
--- a/src/semantics/value/value.c
+++ b/src/semantics/value/value.c
return (struct Expression_Value*)ret;
}
- struct Expression_Value* get_expression_value_temp_value(struct Object *temp_object)
+ struct Expression_Value* get_expression_value_rvalue(struct Object *temp_object)
{
struct Expression_Value_Temp_Value *ret;
ret=malloc(sizeof(struct Expression_Value_Temp_Value));
delete_expression_value_lvalue((struct Expression_Value_LValue*)expression_value);
return;
case VALUE_TEMP:
- delete_expression_value_temp_value((struct Expression_Value_Temp_Value*)expression_value);
+ delete_expression_value_rvalue((struct Expression_Value_Temp_Value*)expression_value);
return;
case VALUE_FUNCTION_DESIGNATOR:
delete_expression_value_function_designator((struct Expression_Value_Function_Designator*)expression_value);
delete_constant(constant_expression_value->constant);
free(constant_expression_value);
}
- void delete_expression_value_temp_value(struct Expression_Value_Temp_Value *temp_value)
+ void delete_expression_value_rvalue(struct Expression_Value_RValue *temp_value)
{
delete_object(temp_value->temp_object);
free(temp_value);
F diff --git a/src/semantics/value/value.h b/src/semantics/value/value.h
--- a/src/semantics/value/value.h
+++ b/src/semantics/value/value.h
{
enum Expression_Value_Type type;
struct Object *object;
+ char is_modifiable;
};
struct Expression_Value_Constant
struct Constant *constant;
};
- struct Expression_Value_Temp_Value
+ struct Expression_Value_RValue
{
enum Expression_Value_Type type;
struct Object *temp_object;
struct Expression_Value* get_expression_value_void();
struct Expression_Value* get_expression_value_lvalue(struct Object *object);
struct Expression_Value* get_expression_value_constant(struct Constant *constant);
- struct Expression_Value* get_expression_value_temp_value(struct Object *temp_object);
+ struct Expression_Value* get_expression_value_rvalue(struct Object *temp_object);
struct Expression_Value* get_expression_value_function_designator(struct Denoted_Function *function);
struct Type* extract_expresion_value_type(struct Expression_Value *expression_value,struct Translation_Data *translation_data);
void delete_expression_value_void(struct Expression_Value *void_expression_value);
void delete_expression_value_lvalue(struct Expression_Value_LValue *lvalue);
void delete_expression_value_constant(struct Expression_Value_Constant *constant_expression_value);
- void delete_expression_value_temp_value(struct Expression_Value_Temp_Value *temp_value);
+ void delete_expression_value_rvalue(struct Expression_Value_RValue *temp_value);
void delete_expression_value_function_designator(struct Expression_Value_Function_Designator *function_designator);