Changeset 1cdfa82 for src/SynTree/Expression.cc
- Timestamp:
- Apr 25, 2018, 4:55:53 PM (6 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
r2efe4b8 r1cdfa82 238 238 } 239 239 240 CastExpr::CastExpr( Expression *arg _, Type *toType ) : Expression(), arg(arg_) {240 CastExpr::CastExpr( Expression *arg, Type *toType, bool isGenerated ) : Expression(), arg(arg), isGenerated( isGenerated ) { 241 241 set_result(toType); 242 242 } 243 243 244 CastExpr::CastExpr( Expression *arg _ ) : Expression(), arg(arg_) {244 CastExpr::CastExpr( Expression *arg, bool isGenerated ) : Expression(), arg(arg), isGenerated( isGenerated ) { 245 245 set_result( new VoidType( Type::Qualifiers() ) ); 246 246 } 247 247 248 CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) {248 CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ) { 249 249 } 250 250 … … 259 259 result->print( os, indent+1 ); 260 260 } // if 261 Expression::print( os, indent ); 262 } 263 264 KeywordCastExpr::KeywordCastExpr( Expression *arg, Target target ) : Expression(), arg(arg), target( target ) { 265 } 266 267 KeywordCastExpr::KeywordCastExpr( const KeywordCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), target( other.target ) { 268 } 269 270 KeywordCastExpr::~KeywordCastExpr() { 271 delete arg; 272 } 273 274 const 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 285 void 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(); 261 290 Expression::print( os, indent ); 262 291 }
Note: See TracChangeset
for help on using the changeset viewer.