Ignore:
Timestamp:
May 22, 2019, 5:22:30 PM (6 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:
893e106
Parents:
6380f78
Message:

Broken stuff pre-Pass fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/TypeSubstitution.hpp

    r6380f78 r76ed81f  
    3030#include "Decl.hpp"
    3131#include "Expr.hpp"
     32#include "Node.hpp"
    3233
    3334namespace ast {
     
    4344        TypeSubstitution &operator=( const TypeSubstitution &other );
    4445
    45         template< typename SynTreeClass > int apply( SynTreeClass *&input ) const;
    46         template< typename SynTreeClass > int applyFree( SynTreeClass *&input ) const;
     46        template< typename SynTreeClass > int apply( const SynTreeClass *& input ) const;
     47        template< typename SynTreeClass > int applyFree( const SynTreeClass *& input ) const;
     48
     49        template< typename node_t, enum Node::ref_type ref_t >
     50        int apply( ptr_base< node_t, ref_t > & input ) const {
     51                const node_t * p = input.get();
     52                int ret = apply(p);
     53                input = p;
     54                return ret;
     55        }
     56
     57        template< typename node_t, enum Node::ref_type ref_t >
     58        int applyFree( ptr_base< node_t, ref_t > & input ) const {
     59                const node_t * p = input.get();
     60                int ret = applyFree(p);
     61                input = p;
     62                return ret;
     63        }
    4764
    4865        void add( std::string formalType, const Type *actualType );
     
    162179
    163180template< typename SynTreeClass >
    164 int TypeSubstitution::apply( SynTreeClass *&input ) const {
     181int TypeSubstitution::apply( const SynTreeClass *& input ) const {
    165182        assert( input );
    166183        Pass<Substituter> sub( *this, false );
    167         input = strict_dynamic_cast< SynTreeClass * >( input->accept( sub ) );
     184        input = strict_dynamic_cast< const SynTreeClass * >( input->accept( sub ) );
    168185///     std::cerr << "substitution result is: ";
    169186///     newType->print( std::cerr );
     
    173190
    174191template< typename SynTreeClass >
    175 int TypeSubstitution::applyFree( SynTreeClass *&input ) const {
     192int TypeSubstitution::applyFree( const SynTreeClass *& input ) const {
    176193        assert( input );
    177194        Pass<Substituter> sub( *this, true );
    178         input = strict_dynamic_cast< SynTreeClass * >( input->accept( sub ) );
     195        input = strict_dynamic_cast< const SynTreeClass * >( input->accept( sub ) );
    179196///     std::cerr << "substitution result is: ";
    180197///     newType->print( std::cerr );
Note: See TracChangeset for help on using the changeset viewer.