Changeset 3096ec1


Ignore:
Timestamp:
Oct 2, 2017, 6:02:25 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:
11a2d9b
Parents:
9d79f93
Message:

Convert TtypeExpander? to PassVisitor?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Unify.cc

    r9d79f93 r3096ec1  
    2222#include <utility>                // for pair
    2323
     24#include "Common/PassVisitor.h"   // for PassVisitor
    2425#include "FindOpenVars.h"         // for findOpenVars
    2526#include "Parser/LinkageSpec.h"   // for C
     
    537538        /// If this isn't done then argument lists can have wildly different
    538539        /// size and structure, when they should be compatible.
    539         struct TtypeExpander : public Mutator {
    540                 TypeEnvironment & env;
    541                 TtypeExpander( TypeEnvironment & env ) : env( env ) {}
    542                 Type * mutate( TypeInstType * typeInst ) {
     540        struct TtypeExpander : public WithShortCircuiting {
     541                TypeEnvironment & tenv;
     542                TtypeExpander( TypeEnvironment & tenv ) : tenv( tenv ) {}
     543                void premutate( TypeInstType * ) { visit_children = false; }
     544                Type * postmutate( TypeInstType * typeInst ) {
    543545                        EqvClass eqvClass;
    544                         if ( env.lookup( typeInst->get_name(), eqvClass ) ) {
     546                        if ( tenv.lookup( typeInst->get_name(), eqvClass ) ) {
    545547                                if ( eqvClass.data.kind == TypeDecl::Ttype ) {
    546548                                        // expand ttype parameter into its actual type
     
    560562                dst.clear();
    561563                for ( DeclarationWithType * dcl : src ) {
    562                         TtypeExpander expander( env );
     564                        PassVisitor<TtypeExpander> expander( env );
    563565                        dcl->acceptMutator( expander );
    564566                        std::list< Type * > types;
     
    750752                        std::list<Type *> types1, types2;
    751753
    752                         TtypeExpander expander( env );
     754                        PassVisitor<TtypeExpander> expander( env );
    753755                        flat1->acceptMutator( expander );
    754756                        flat2->acceptMutator( expander );
Note: See TracChangeset for help on using the changeset viewer.