Changeset 0b73f0c for src/AST


Ignore:
Timestamp:
Jun 7, 2019, 12:00:12 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
9151fcb
Parents:
f46bfd2f
Message:

More progress on the conversion pass

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    rf46bfd2f r0b73f0c  
    735735                expr->var = get<DeclarationWithType>().accept1(node->var);
    736736                Type * type = expr->var->get_type()->clone();
     737                if(FunctionType * ft = dynamic_cast<FunctionType*>(type)) {
     738                        if(node->result.as<ast::PointerType>()) {
     739                                type = new PointerType({}, ft);
     740                        }
     741                }
     742
    737743                type->set_lvalue( true );
    738                 expr->set_result( type );
     744                expr->result = type ;
    739745                this->node = expr;
    740746                return nullptr;
     
    782788                        assert (!rslt->isType);
    783789                }
    784                 if (node->type) {
     790                else {
     791                        assert(node->type);
    785792                        rslt = new SizeofExpr(
    786793                                get<Type>().accept1(node->type)
     
    803810                        assert (!rslt->isType);
    804811                }
    805                 if (node->type) {
     812                else {
     813                        assert(node->type);
    806814                        rslt = new AlignofExpr(
    807815                                get<Type>().accept1(node->type)
     
    21492157                );
    21502158
    2151                 visitBaseExpr( old,
     2159                visitBaseExpr_SkipResultType( old,
    21522160                        expr
    21532161                );
     
    21552163                expr->var = GET_ACCEPT_1(var, DeclWithType);
    21562164                expr->result = expr->var->get_type();
     2165                if(const ast::FunctionType * ft = expr->result.as<ast::FunctionType>()) {
     2166                        if(dynamic_cast<PointerType *>(old->result)) {
     2167                                expr->result = new ast::PointerType(ft);
     2168                        }
     2169                }
    21572170                add_qualifiers( expr->result, ast::CV::Lvalue );
    21582171                this->node = expr;
Note: See TracChangeset for help on using the changeset viewer.