Ignore:
Timestamp:
Apr 25, 2018, 4:55:53 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
42107b4
Parents:
2efe4b8 (diff), 9d5fb67 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'origin/master' into with_gc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    r2efe4b8 r1cdfa82  
    238238}
    239239
    240 CastExpr::CastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) {
     240CastExpr::CastExpr( Expression *arg, Type *toType, bool isGenerated ) : Expression(), arg(arg), isGenerated( isGenerated ) {
    241241        set_result(toType);
    242242}
    243243
    244 CastExpr::CastExpr( Expression *arg_ ) : Expression(), arg(arg_) {
     244CastExpr::CastExpr( Expression *arg, bool isGenerated ) : Expression(), arg(arg), isGenerated( isGenerated ) {
    245245        set_result( new VoidType( Type::Qualifiers() ) );
    246246}
    247247
    248 CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) {
     248CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ) {
    249249}
    250250
     
    259259                result->print( os, indent+1 );
    260260        } // if
     261        Expression::print( os, indent );
     262}
     263
     264KeywordCastExpr::KeywordCastExpr( Expression *arg, Target target ) : Expression(), arg(arg), target( target ) {
     265}
     266
     267KeywordCastExpr::KeywordCastExpr( const KeywordCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), target( other.target ) {
     268}
     269
     270KeywordCastExpr::~KeywordCastExpr() {
     271        delete arg;
     272}
     273
     274const std::string & KeywordCastExpr::targetString() const {
     275        static const std::string targetStrs[] = {
     276                "coroutine", "thread", "monitor"
     277        };
     278        static_assert(
     279                (sizeof(targetStrs) / sizeof(targetStrs[0])) == ((unsigned long)NUMBER_OF_TARGETS),
     280                "Each KeywordCastExpr::Target should have a corresponding string representation"
     281        );
     282        return targetStrs[(unsigned long)target];
     283}
     284
     285void KeywordCastExpr::print( std::ostream &os, Indenter indent ) const {
     286        os << "Keyword Cast of:" << std::endl << indent+1;
     287        arg->print(os, indent+1);
     288        os << std::endl << indent << "... to: ";
     289        os << targetString();
    261290        Expression::print( os, indent );
    262291}
Note: See TracChangeset for help on using the changeset viewer.