Ignore:
Timestamp:
Jun 6, 2019, 10:55:00 AM (5 years ago)
Author:
Andrew Beach <ajbeach@…>
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:
546e712
Parents:
dd857bb
Message:

Convert persevers Validate::SizeType?. Removed the inCache checks I'm sure are duplicates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    rdd857bb r2a54479  
    1010// Created On       : Thu May 09 15::37::05 2019
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed May 29 17:05:00 2019
    13 // Update Count     : 9
     12// Last Modified On : Thu May 06 19:51:00 2019
     13// Update Count     : 10
    1414//
    1515
     
    4949// This is to preserve the FindSpecialDecls hack. It does not (and perhaps should not)
    5050// allow us to use the same stratagy in the new ast.
     51ast::Type * sizeType = nullptr;
    5152ast::FunctionDecl * dereferenceOperator = nullptr;
    5253ast::StructDecl   * dtorStruct = nullptr;
     
    709710                auto expr = visitBaseExpr( node,
    710711                        new MemberExpr(
    711                                 inCache(node->member) ?
    712                                         dynamic_cast<DeclarationWithType *>(this->node) :
    713                                         get<DeclarationWithType>().accept1(node->member),
     712                                get<DeclarationWithType>().accept1(node->member),
    714713                                get<Expression>().accept1(node->aggregate)
    715714                        )
     
    722721                auto expr = visitBaseExpr( node,
    723722                        new VariableExpr(
    724                                 inCache(node->var) ?
    725                                         dynamic_cast<DeclarationWithType *>(this->node) :
    726                                         get<DeclarationWithType>().accept1(node->var)
     723                                get<DeclarationWithType>().accept1(node->var)
    727724                        )
    728725                );
     
    819816                        new OffsetofExpr(
    820817                                get<Type>().accept1(node->type),
    821                                 inCache(node->member) ?
    822                                         dynamic_cast<DeclarationWithType *>(this->node) :
    823                                         get<DeclarationWithType>().accept1(node->member)
     818                                get<DeclarationWithType>().accept1(node->member)
    824819                        )
    825820                );
     
    10821077
    10831078        const ast::Type * visit( const ast::BasicType * node ) override final {
    1084                 this->node = new BasicType{ cv( node ), (BasicType::Kind)(unsigned)node->kind };
     1079                auto type = new BasicType{ cv( node ), (BasicType::Kind)(unsigned)node->kind };
     1080                // I believe this should always be a BasicType.
     1081                if ( sizeType == node ) {
     1082                        Validate::SizeType = type;
     1083                }
     1084                this->node = type;
    10851085                return nullptr;
    10861086        }
     
    20922092                        new ast::MemberExpr(
    20932093                                old->location,
    2094                                 inCache(old->member) ?
    2095                                         dynamic_cast<ast::DeclWithType *>(this->node) :
    2096                                         GET_ACCEPT_1(member, DeclWithType),
     2094                                GET_ACCEPT_1(member, DeclWithType),
    20972095                                GET_ACCEPT_1(aggregate, Expr)
    20982096                        )
     
    21042102                        new ast::VariableExpr(
    21052103                                old->location,
    2106                                 inCache(old->var) ?
    2107                                         dynamic_cast<ast::DeclWithType *>(this->node) :
    2108                                         GET_ACCEPT_1(var, DeclWithType)
     2104                                GET_ACCEPT_1(var, DeclWithType)
    21092105                        )
    21102106                );
     
    22342230                                old->location,
    22352231                                GET_ACCEPT_1(type, Type),
    2236                                 inCache(old->member) ?
    2237                                         dynamic_cast<ast::DeclWithType *>(this->node) :
    2238                                         GET_ACCEPT_1(member, DeclWithType)
     2232                                GET_ACCEPT_1(member, DeclWithType)
    22392233                        )
    22402234                );
     
    24722466
    24732467        virtual void visit( BasicType * old ) override final {
    2474                 this->node = new ast::BasicType{ (ast::BasicType::Kind)(unsigned)old->kind, cv( old ) };
     2468                auto type = new ast::BasicType{ (ast::BasicType::Kind)(unsigned)old->kind, cv( old ) };
     2469                // I believe this should always be a BasicType.
     2470                if ( Validate::SizeType == old ) {
     2471                        sizeType = type;
     2472                }
     2473                this->node = type;
    24752474        }
    24762475
Note: See TracChangeset for help on using the changeset viewer.