Changeset ca69a8a


Ignore:
Timestamp:
Jul 14, 2021, 3:49:54 PM (3 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
7ff35e0e
Parents:
801978b
Message:

Quickly added VTableType node to the old ast.

Location:
src/SynTree
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Type.cc

    r801978b rca69a8a  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Dec 15 16:52:37 2019
    13 // Update Count     : 49
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jul 14 15:47:00 2021
     13// Update Count     : 50
    1414//
    1515#include "Type.h"
     
    178178}
    179179
     180VTableType::VTableType( const Type::Qualifiers &tq, Type *base, const std::list< Attribute * > & attributes )
     181                : Type( tq, attributes ), base( base ) {
     182        assertf( base, "VTableType with a null base created." );
     183}
     184
     185VTableType::VTableType( const VTableType &other )
     186                : Type( other ), base( other.base->clone() ) {
     187}
     188
     189VTableType::~VTableType() {
     190        delete base;
     191}
     192
     193void VTableType::print( std::ostream &os, Indenter indent ) const {
     194        Type::print( os, indent );
     195        os << "get virtual-table type of ";
     196        if ( base ) {
     197                base->print( os, indent );
     198        } // if
     199}
     200
    180201// Local Variables: //
    181202// tab-width: 4 //
  • src/SynTree/Type.h

    r801978b rca69a8a  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Sep  4 09:58:00 2019
    13 // Update Count     : 170
     12// Last Modified On : Wed Jul 14 15:40:00 2021
     13// Update Count     : 171
    1414//
    1515
     
    651651};
    652652
     653class VTableType : public Type {
     654public:
     655        Type *base;
     656
     657        VTableType( const Type::Qualifiers & tq, Type *base,
     658                const std::list< Attribute * > & attributes = std::list< Attribute * >() );
     659        VTableType( const VTableType & );
     660        virtual ~VTableType();
     661
     662        Type *get_base() { return base; }
     663        void set_base( Type *newValue ) { base = newValue; }
     664
     665        virtual VTableType *clone() const override { return new VTableType( *this ); }
     666        virtual void accept( Visitor & v ) override { v.visit( this ); }
     667        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     668        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     669        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
     670};
     671
    653672class AttrType : public Type {
    654673  public:
Note: See TracChangeset for help on using the changeset viewer.