Ignore:
Timestamp:
Apr 19, 2018, 5:18:46 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
da9d79b
Parents:
60ba456
Message:

Implement concurrency keyword casts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    r60ba456 r9a705dc8  
    299299}
    300300
     301KeywordCastExpr::KeywordCastExpr( Expression *arg, Target target ) : Expression(), arg(arg), target( target ) {
     302}
     303
     304KeywordCastExpr::KeywordCastExpr( const KeywordCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), target( other.target ) {
     305}
     306
     307KeywordCastExpr::~KeywordCastExpr() {
     308        delete arg;
     309}
     310
     311const std::string & KeywordCastExpr::targetString() const {
     312        static const std::string targetStrs[] = {
     313                "coroutine", "thread", "monitor"
     314        };
     315        static_assert(
     316                (sizeof(targetStrs) / sizeof(targetStrs[0])) == ((unsigned long)NUMBER_OF_TARGETS),
     317                "Each KeywordCastExpr::Target should have a corresponding string representation"
     318        );
     319        return targetStrs[(unsigned long)target];
     320}
     321
     322void KeywordCastExpr::print( std::ostream &os, Indenter indent ) const {
     323        os << "Keyword Cast of:" << std::endl << indent+1;
     324        arg->print(os, indent+1);
     325        os << std::endl << indent << "... to: ";
     326        os << targetString();
     327        Expression::print( os, indent );
     328}
     329
    301330VirtualCastExpr::VirtualCastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) {
    302331        set_result(toType);
Note: See TracChangeset for help on using the changeset viewer.