Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ExpressionNode.cc

    r630a82a r2a4b088  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Apr  8 15:43:05 2016
    13 // Update Count     : 296
     12// Last Modified On : Mon Feb  1 13:32:30 2016
     13// Update Count     : 271
    1414//
    1515
     
    2222
    2323#include "ParseNode.h"
    24 #include "TypeData.h"
    2524#include "SynTree/Constant.h"
    2625#include "SynTree/Expression.h"
    27 #include "SynTree/Declaration.h"
    2826#include "Common/UnimplementedError.h"
    2927#include "parseutility.h"
     
    489487                args.front() = new AddressExpr( args.front() );
    490488                break;
    491           default:              // do nothing
     489          default:
     490                /* do nothing */
    492491                ;
    493         } // switch
     492        }
    494493
    495494        switch ( op->get_type() ) {
     
    874873}
    875874
    876 
    877 CompoundLiteralNode::CompoundLiteralNode( DeclarationNode *type, InitializerNode *kids ) : type( type ), kids( kids ) {}
    878 CompoundLiteralNode::CompoundLiteralNode( const CompoundLiteralNode &other ) : ExpressionNode( other ), type( other.type ), kids( other.kids ) {}
    879 
    880 CompoundLiteralNode::~CompoundLiteralNode() {
    881         delete kids;
    882         delete type;
    883 }
    884 
    885 CompoundLiteralNode *CompoundLiteralNode::clone() const {
    886         return new CompoundLiteralNode( *this );
    887 }
    888 
    889 void CompoundLiteralNode::print( std::ostream &os, int indent ) const {
    890         os << string( indent,' ' ) << "CompoundLiteralNode:" << endl;
    891 
    892         os << string( indent + 2, ' ' ) << "type:" << endl;
    893         if ( type != 0 )
    894                 type->print( os, indent + 4 );
    895 
    896         os << string( indent + 2, ' ' ) << "initialization:" << endl;
    897         if ( kids != 0 )
    898                 kids->printList( os, indent + 4 );
    899 }
    900 
    901 void CompoundLiteralNode::printOneLine( std::ostream &os, int indent ) const {
    902         os << "( ";
    903         if ( type ) type->print( os );
    904         os << ", ";
    905         if ( kids ) kids->printOneLine( os );
    906         os << ") ";
    907 }
    908 
    909 Expression *CompoundLiteralNode::build() const {
    910         Declaration * newDecl = type->build();                          // compound literal type
    911         if ( DeclarationWithType * newDeclWithType = dynamic_cast< DeclarationWithType * >( newDecl ) ) { // non-sue compound-literal type
    912                 return new CompoundLiteralExpr( newDeclWithType->get_type(), kids->build() );
    913         // these types do not have associated type information
    914         } else if ( StructDecl * newDeclStructDecl = dynamic_cast< StructDecl * >( newDecl )  ) {
    915                 return new CompoundLiteralExpr( new StructInstType( Type::Qualifiers(), newDeclStructDecl->get_name() ), kids->build() );
    916         } else if ( UnionDecl * newDeclUnionDecl = dynamic_cast< UnionDecl * >( newDecl )  ) {
    917                 return new CompoundLiteralExpr( new UnionInstType( Type::Qualifiers(), newDeclUnionDecl->get_name() ), kids->build() );
    918         } else if ( EnumDecl * newDeclEnumDecl = dynamic_cast< EnumDecl * >( newDecl )  ) {
    919                 return new CompoundLiteralExpr( new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() ), kids->build() );
    920         } else {
    921                 assert( false );
    922         } // if
    923 }
    924 
    925 
    926875ExpressionNode *flattenCommas( ExpressionNode *list ) {
    927876        if ( CompositeExprNode *composite = dynamic_cast< CompositeExprNode * >( list ) ) {
Note: See TracChangeset for help on using the changeset viewer.