Пример #1
0
 private void VisitDerefNode(dereference_node en)
 {
     VisitExpression(en.deref_expr);
 }
 public override void visit(SyntaxTree.roof_dereference _roof_dereference)
 {
     expression_node exp = null;
     motivation mot = motivation_keeper.motivation;
     /*
     if (mot == motivation.address_reciving)
     {
         tmp = motivation_keeper.motivation;
     }
     */
     exp = convert_strong(_roof_dereference.dereferencing_value);
     if (exp is typed_expression) exp = convert_typed_expression_to_function_call(exp as typed_expression);
     //Check this expression
     ref_type_node rtn = exp.type as ref_type_node;
     //TODO: Сделать нормальное сообщение об ошибке.
     if (rtn == null)
     {
         AddError(get_location(_roof_dereference.dereferencing_value), "CANNOT_DEREFER_THIS_EXPR_OF_NON_POINTER_TYPE");
     }
     if (rtn.pointed_type == null)
         AddError(get_location(_roof_dereference.dereferencing_value), "TYPE_{0}_IS_NOT_DETERMINED_COMPLETELY", rtn.PointedTypeName);
     dereference_node res = new dereference_node(exp, get_location(_roof_dereference));
     switch (mot)
     {
         case motivation.address_reciving: return_addressed_value(res); break;
         case motivation.expression_evaluation: return_value(res); break;
         case motivation.semantic_node_reciving: return_semantic_value(res); break;
     }
     return;
 }