Changeset 514a791


Ignore:
Timestamp:
May 21, 2019, 4:33:30 PM (5 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
a1b154d, b869ec5
Parents:
a83044fb
Message:

Fix compile errors on previous push

Location:
src/AST
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    ra83044fb r514a791  
    5050                ConverterNewToOld & visitor;
    5151
    52                 template<typename U>
    53                 T * accept1( const ast::ptr<U> & ptr ) {
     52                template<typename U, enum ast::Node::ref_type R>
     53                T * accept1( const ast::ptr_base<U, R> & ptr ) {
    5454                        if ( ! ptr ) return nullptr;
    5555                        ptr->accept( visitor );
     
    9595
    9696        template<typename NewT, typename OldT>
    97         NewT * cached( OldT * old ) {
    98                 auto it = cache.find( old );
    99                 // doesn't update cache, that should be handled by the accept function
    100                 ast::Node * nw = it == cache.end() ? getAccept1< NewT >( old ) : it->second;
    101                 return strict_dynamic_cast< NewT * >( nw );
     97        NewT * cached( const OldT & old ) {
     98                auto it = cache.find( old.get() );
     99                if ( it == cache.end() ) {
     100                        // doesn't update cache, that should be handled by the accept function
     101                        return get< NewT >().accept1( old );
     102                } else {
     103                        return strict_dynamic_cast< NewT * >( it->second );
     104                }
    102105        }
    103106
     
    797800                ty->parameters = get<DeclarationWithType>().acceptL( node->params );
    798801                ty->forall = get<TypeDecl>().acceptL( node->forall );
    799                 node = ty;
     802                this->node = ty;
    800803                return nullptr;
    801804        }
     
    16791682
    16801683        virtual void visit( TypeInstType * old ) override final {
    1681                 auto ty = new ast::TypeInstType{
    1682                         cached< ast::TypeDecl >( old->baseStruct ),
    1683                         cv( old ),
    1684                         GET_ACCEPT_V( attributes, Attribute )
    1685                 };
     1684                ast::TypeInstType * ty;
     1685                if ( old->baseType ) {
     1686                        ty = new ast::TypeInstType{
     1687                                old->name,
     1688                                cached< ast::TypeDecl >( old->baseType ),
     1689                                cv( old ),
     1690                                GET_ACCEPT_V( attributes, Attribute )
     1691                        };
     1692                } else {
     1693                        ty = new ast::TypeInstType{
     1694                                old->name,
     1695                                old->isFtype ? ast::TypeVar::Ftype : ast::TypeVar::Dtype,
     1696                                cv( old ),
     1697                                GET_ACCEPT_V( attributes, Attribute )
     1698                        };
     1699                }
    16861700                postvisit( old, ty );
    16871701                this->node = ty;
  • src/AST/Type.cpp

    ra83044fb r514a791  
    141141bool EnumInstType::isComplete() const { return base ? base->body : false; }
    142142
     143// --- TraitInstType
     144
     145TraitInstType::TraitInstType( const TraitDecl * b, CV::Qualifiers q,
     146        std::vector<ptr<Attribute>>&& as )
     147: ReferenceToType( b->name, q, std::move(as) ), base( b ) {}
     148
    143149// --- TypeInstType
    144150
Note: See TracChangeset for help on using the changeset viewer.