Changeset c20b0fea


Ignore:
Timestamp:
Feb 2, 2018, 3:46:29 PM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
11b7028
Parents:
20cba76
Message:

Perform pointer decay on instantiated generic member expressions [fixes #78]

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/InstantiateGeneric.cc

    r20cba76 rc20b0fea  
    476476                        DeclarationWithType * field = strict_dynamic_cast< DeclarationWithType * >( member );
    477477                        MemberExpr * ret = new MemberExpr( field, memberExpr->aggregate->clone() );
     478                        ResolvExpr::adjustExprType( ret->result ); // pointer decay
    478479                        std::swap( ret->env, memberExpr->env );
    479480                        delete memberExpr;
  • src/ResolvExpr/AdjustExprType.cc

    r20cba76 rc20b0fea  
    2424        class AdjustExprType : public WithShortCircuiting {
    2525          public:
    26                 AdjustExprType( const TypeEnvironment &env, const SymTab::Indexer &indexer );
     26                AdjustExprType( const TypeEnvironment & env, const SymTab::Indexer & indexer );
    2727                void premutate( VoidType * ) { visit_children = false; }
    2828                void premutate( BasicType * ) { visit_children = false; }
     
    4545
    4646          private:
    47                 const TypeEnvironment &env;
    48                 const SymTab::Indexer &indexer;
     47                const TypeEnvironment & env;
     48                const SymTab::Indexer & indexer;
    4949        };
    5050
     
    5353                Type *newType = type->acceptMutator( adjuster );
    5454                type = newType;
     55        }
     56
     57        void adjustExprType( Type *& type ) {
     58                TypeEnvironment env;
     59                SymTab::Indexer indexer;
     60                adjustExprType( type, env, indexer );
    5561        }
    5662
  • src/ResolvExpr/typeops.h

    r20cba76 rc20b0fea  
    5555        /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function
    5656        void adjustExprType( Type *&type, const TypeEnvironment &env, const SymTab::Indexer &indexer );
     57
     58        /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function using empty TypeEnvironment and Indexer
     59        void adjustExprType( Type *& type );
    5760
    5861        template< typename ForwardIterator >
Note: See TracChangeset for help on using the changeset viewer.