Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Constant.cc

    rd56e5bc rcb4c607  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 21 16:44:48 2017
    13 // Update Count     : 27
     12// Last Modified On : Thu Jul 30 15:18:38 2015
     13// Update Count     : 12
    1414//
    1515
     
    2121#include "Type.h"
    2222
    23 Constant::Constant( Type * type, std::string rep, unsigned long long val ) : type( type ), rep( rep ), val( val ) {}
    24 Constant::Constant( Type * type, std::string rep, double val ) : type( type ), rep( rep ), val( val ) {}
     23Constant::Constant( Type *type_, std::string value_ ) : type( type_ ), value( value_ ) {}
    2524
    26 Constant::Constant( const Constant &other ) : rep( other.rep ), val( other.val ) {
     25Constant::Constant( const Constant &other ) {
    2726        type = other.type->clone();
     27        value = other.value;
    2828}
    2929
     
    3131
    3232Constant Constant::from_int( int i ) {
    33         return Constant( new BasicType( Type::Qualifiers(), BasicType::SignedInt ), std::to_string( i ), (unsigned long long int)i );
     33        return Constant( new BasicType( Type::Qualifiers(), BasicType::SignedInt ), std::to_string( i ) );
    3434}
    3535
    3636Constant Constant::from_ulong( unsigned long i ) {
    37         return Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), std::to_string( i ), (unsigned long long int)i );
     37        return Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), std::to_string( i ) );
    3838}
    3939
    4040Constant Constant::from_double( double d ) {
    41         return Constant( new BasicType( Type::Qualifiers(), BasicType::Double ), std::to_string( d ), d );
     41        return Constant( new BasicType( Type::Qualifiers(), BasicType::Double ), std::to_string( d ) );
    4242}
    4343
     44Constant *Constant::clone() const { assert( false ); return 0; }
     45
    4446void Constant::print( std::ostream &os ) const {
    45         os << "(" << rep << " " << val.ival;
     47        os << "(" << value;
    4648        if ( type ) {
    4749                os << ": ";
Note: See TracChangeset for help on using the changeset viewer.