Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    rafc1045 r630a82a  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Dec 09 14:10:29 2015
    13 // Update Count     : 34
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Apr  8 17:16:23 2016
     13// Update Count     : 40
    1414//
    1515
     
    2222
    2323#include "Type.h"
     24#include "Initializer.h"
    2425#include "Expression.h"
    2526#include "Declaration.h"
     
    211212
    212213        os << " of ";
    213 
    214         if ( type ) {
    215                 type->print(os, indent + 2);
    216         } else {
    217                 os << "<NULL>";
    218         }
    219 
    220         os << std::endl;
    221         Expression::print( os, indent );
    222 }
    223 
    224 OffsetPackExpr::OffsetPackExpr( StructInstType *type_, Expression *aname_ ) : Expression( aname_ ), type( type_ ) {
    225         add_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );
    226 }
    227 
    228 OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {}
    229 
    230 OffsetPackExpr::~OffsetPackExpr() { delete type; }
    231 
    232 void OffsetPackExpr::print( std::ostream &os, int indent ) const {
    233         os << std::string( indent, ' ' ) << "Offset pack expression on ";
    234214
    235215        if ( type ) {
     
    464444
    465445
     446CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : type( type ), initializer( initializer ) {
     447        add_result( type->clone() );
     448}
     449
     450CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), type( maybeClone( other.type ) ), initializer( maybeClone( other.initializer ) ) {}
     451
     452CompoundLiteralExpr::~CompoundLiteralExpr() {
     453        delete initializer;
     454        delete type;
     455}
     456
     457void CompoundLiteralExpr::print( std::ostream &os, int indent ) const {
     458        os << "Compound Literal Expression: " << std::endl;
     459        if ( type ) type->print( os, indent + 2 );
     460        if ( initializer ) initializer->print( os, indent + 2 );
     461}
     462
    466463
    467464std::ostream & operator<<( std::ostream & out, Expression * expr ) {
Note: See TracChangeset for help on using the changeset viewer.