Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    r60aaa51d r0b73f0c  
    1616#include "Convert.hpp"
    1717
    18 #include <deque>
    1918#include <unordered_map>
    2019
     
    576575
    577576                if ( srcInferred.mode == ast::Expr::InferUnion::Params ) {
    578                         const ast::InferredParams &srcParams = srcInferred.inferParams();
     577                        const ast::InferredParams &srcParams = srcInferred.inferParamsConst();
    579578                        for (auto srcParam : srcParams) {
    580579                                tgtInferParams[srcParam.first] = ParamEntry(
     
    586585                        }
    587586                } else if ( srcInferred.mode == ast::Expr::InferUnion::Slots  ) {
    588                         const ast::ResnSlots &srcSlots = srcInferred.resnSlots();
     587                        const ast::ResnSlots &srcSlots = srcInferred.resnSlotsConst();
    589588                        for (auto srcSlot : srcSlots) {
    590589                                tgtResnSlots.push_back(srcSlot);
     
    736735                expr->var = get<DeclarationWithType>().accept1(node->var);
    737736                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
    738743                type->set_lvalue( true );
    739                 expr->set_result( type );
     744                expr->result = type ;
    740745                this->node = expr;
    741746                return nullptr;
     
    783788                        assert (!rslt->isType);
    784789                }
    785                 if (node->type) {
     790                else {
     791                        assert(node->type);
    786792                        rslt = new SizeofExpr(
    787793                                get<Type>().accept1(node->type)
     
    804810                        assert (!rslt->isType);
    805811                }
    806                 if (node->type) {
     812                else {
     813                        assert(node->type);
    807814                        rslt = new AlignofExpr(
    808815                                get<Type>().accept1(node->type)
     
    14141421#       define GET_ACCEPT_V(child, type) \
    14151422                getAcceptV< ast::type, decltype( old->child ) >( old->child )
    1416        
    1417         template<typename NewT, typename OldC>
    1418         std::deque< ast::ptr<NewT> > getAcceptD( OldC& old ) {
    1419                 std::deque< ast::ptr<NewT> > ret;
    1420                 for ( auto a : old ) {
    1421                         a->accept( *this );
    1422                         ret.emplace_back( strict_dynamic_cast< NewT * >(node) );
    1423                         node = nullptr;
    1424                 }
    1425                 return ret;
    1426         }
    1427 
    1428 #       define GET_ACCEPT_D(child, type) \
    1429                 getAcceptD< ast::type, decltype( old->child ) >( old->child )
    14301423
    14311424        ast::Label make_label(Label* old) {
     
    21642157                );
    21652158
    2166                 visitBaseExpr( old,
     2159                visitBaseExpr_SkipResultType( old,
    21672160                        expr
    21682161                );
     
    21702163                expr->var = GET_ACCEPT_1(var, DeclWithType);
    21712164                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                }
    21722170                add_qualifiers( expr->result, ast::CV::Lvalue );
    21732171                this->node = expr;
     
    24642462
    24652463        virtual void visit( UntypedInitExpr * old ) override final {
    2466                 std::deque<ast::InitAlternative> initAlts;
     2464                std::vector<ast::InitAlternative> initAlts;
    24672465                for (auto ia : old->initAlts) {
    24682466                        initAlts.push_back(ast::InitAlternative(
     
    27292727                this->node = new ast::Designation(
    27302728                        old->location,
    2731                         GET_ACCEPT_D(designators, Expr)
     2729                        GET_ACCEPT_V(designators, Expr)
    27322730                );
    27332731        }
Note: See TracChangeset for help on using the changeset viewer.