Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/ConversionCost.h

    rbd0b6b62 r0c6596f  
    1919
    2020#include "Cost.h"             // for Cost
    21 
    22 #include "Common/PassVisitor.h"
    2321#include "SynTree/Visitor.h"  // for Visitor
    2422#include "SynTree/SynTree.h"  // for Visitor Nodes
     
    3129        class TypeEnvironment;
    3230
    33         typedef std::function<Cost(Type *, Type *, const SymTab::Indexer &, const TypeEnvironment &)> CostFunction;
    34         struct ConversionCost : public WithShortCircuiting {
     31        class ConversionCost : public Visitor {
    3532          public:
    36                 ConversionCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction );
     33                ConversionCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env );
    3734
    3835                Cost get_cost() const { return cost; }
    3936
    40                 void previsit( BaseSyntaxNode * ) { visit_children = false; }
    41 
    42                 void postvisit( VoidType * voidType );
    43                 void postvisit( BasicType * basicType );
    44                 void postvisit( PointerType * pointerType );
    45                 void postvisit( ArrayType * arrayType );
    46                 void postvisit( ReferenceType * refType );
    47                 void postvisit( FunctionType * functionType );
    48                 void postvisit( StructInstType * aggregateUseType );
    49                 void postvisit( UnionInstType * aggregateUseType );
    50                 void postvisit( EnumInstType * aggregateUseType );
    51                 void postvisit( TraitInstType * aggregateUseType );
    52                 void postvisit( TypeInstType * aggregateUseType );
    53                 void postvisit( TupleType * tupleType );
    54                 void postvisit( VarArgsType * varArgsType );
    55                 void postvisit( ZeroType * zeroType );
    56                 void postvisit( OneType * oneType );
     37                virtual void visit(VoidType *voidType);
     38                virtual void visit(BasicType *basicType);
     39                virtual void visit(PointerType *pointerType);
     40                virtual void visit(ArrayType *arrayType);
     41                virtual void visit(ReferenceType *refType);
     42                virtual void visit(FunctionType *functionType);
     43                virtual void visit(StructInstType *aggregateUseType);
     44                virtual void visit(UnionInstType *aggregateUseType);
     45                virtual void visit(EnumInstType *aggregateUseType);
     46                virtual void visit(TraitInstType *aggregateUseType);
     47                virtual void visit(TypeInstType *aggregateUseType);
     48                virtual void visit(TupleType *tupleType);
     49                virtual void visit(VarArgsType *varArgsType);
     50                virtual void visit(ZeroType *zeroType);
     51                virtual void visit(OneType *oneType);
    5752          protected:
    5853                Type *dest;
     
    6055                Cost cost;
    6156                const TypeEnvironment &env;
    62                 CostFunction costFunc;
    6357        };
    6458
    65         typedef std::function<int(Type *, Type *, const SymTab::Indexer &, const TypeEnvironment &)> PtrsFunction;
     59        typedef std::function<int(Type *, Type *, const TypeEnvironment &, const SymTab::Indexer &)> PtrsFunction;
    6660        Cost convertToReferenceCost( Type * src, ReferenceType * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func );
    6761} // namespace ResolvExpr
Note: See TracChangeset for help on using the changeset viewer.