Ignore:
Timestamp:
Jun 30, 2016, 1:47:52 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
1bc1bb2
Parents:
84d4d6f
Message:

move implementation of ConstantNode? to ConstantExpr?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    r84d4d6f rca35c51  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun 27 23:28:10 2016
    13 // Update Count     : 242
     12// Last Modified On : Thu Jun 30 11:48:28 2016
     13// Update Count     : 252
    1414//
    1515
     
    126126        enum Type { Integer, Float, Character, String };
    127127
    128         ConstantNode( Type, std::string * );
    129         ConstantNode( const ConstantNode &other ) : type( other.type ), btype( other.btype), value( *new std::string( other.value ) ) {};
    130         ~ConstantNode() { delete &value; }
     128        ConstantNode( ConstantExpr * );
     129        ConstantNode( const ConstantNode &other ) : expr( other.expr->clone() ) {};
     130        ~ConstantNode() { delete expr; }
    131131
    132132        virtual ConstantNode *clone() const { return new ConstantNode( *this ); }
    133         Type get_type( void ) const { return type; }
    134133        virtual void print( std::ostream &, int indent = 0) const;
    135134        virtual void printOneLine( std::ostream &, int indent = 0) const;
    136135
    137         const std::string &get_value() const { return value; }
    138136        ConstantNode *appendstr( const std::string *newValue );
    139137
    140138        Expression *build() const;
    141139  private:
    142         Type type;
    143         BasicType::Kind btype;
    144         std::string &value;
    145 };
     140        ConstantExpr *expr;
     141};
     142
     143ConstantNode *makeConstant( ConstantNode::Type, std::string * );
     144ConstantNode *makeConstantStr( ConstantNode::Type type, std::string *str );
    146145
    147146class VarRefNode : public ExpressionNode {
Note: See TracChangeset for help on using the changeset viewer.