Changeset a5f0529 for src/SynTree
- Timestamp:
- Jul 26, 2017, 2:44:09 PM (7 years ago)
- 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, resolv-new, with_gc
- Children:
- 2edd80ae
- Parents:
- b947fb2
- Location:
- src/SynTree
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/ApplicationExpr.cc
rb947fb2 ra5f0529 44 44 } 45 45 46 ApplicationExpr::ApplicationExpr( Expression *funcExpr ) : function( funcExpr) {46 ApplicationExpr::ApplicationExpr( Expression *funcExpr, const std::list< Expression * > & argList ) : function( funcExpr ), args( argList ) { 47 47 PointerType *pointer = safe_dynamic_cast< PointerType* >( funcExpr->get_result() ); 48 48 FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() ); -
src/SynTree/Expression.cc
rb947fb2 ra5f0529 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Mar 30 16:41:13201713 // Update Count : 5 212 // Last Modified On : Tue Jul 25 14:15:47 2017 13 // Update Count : 54 14 14 // 15 15 … … 298 298 if ( result->isVoid() ) { 299 299 os << "nothing"; 300 } else { 301 result->print( os, indent+2 ); 302 } // if 303 os << std::endl; 304 Expression::print( os, indent ); 305 } 306 307 VirtualCastExpr::VirtualCastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) { 308 set_result(toType); 309 } 310 311 VirtualCastExpr::VirtualCastExpr( const VirtualCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) { 312 } 313 314 VirtualCastExpr::~VirtualCastExpr() { 315 delete arg; 316 } 317 318 void VirtualCastExpr::print( std::ostream &os, int indent ) const { 319 os << "Virtual Cast of:" << std::endl << std::string( indent+2, ' ' ); 320 arg->print(os, indent+2); 321 os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl; 322 os << std::string( indent+2, ' ' ); 323 if ( ! result ) { 324 os << "unknown"; 300 325 } else { 301 326 result->print( os, indent+2 ); … … 503 528 } 504 529 505 AsmExpr::AsmExpr( const AsmExpr & other ) : inout( maybeClone( other.inout ) ), constraint( maybeClone( other.constraint ) ), operand( maybeClone( other.operand ) ) {}530 AsmExpr::AsmExpr( const AsmExpr & other ) : Expression( other ), inout( maybeClone( other.inout ) ), constraint( maybeClone( other.constraint ) ), operand( maybeClone( other.operand ) ) {} 506 531 507 532 -
src/SynTree/Expression.h
rb947fb2 ra5f0529 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:53:16201713 // Update Count : 4 211 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jul 24 16:27:00 2017 13 // Update Count : 43 14 14 // 15 15 … … 79 79 class ApplicationExpr : public Expression { 80 80 public: 81 ApplicationExpr( Expression * function );81 ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() ); 82 82 ApplicationExpr( const ApplicationExpr & other ); 83 83 virtual ~ApplicationExpr(); … … 194 194 195 195 Expression * get_arg() const { return arg; } 196 void set_arg( Expression * newValue ) { arg = newValue; }196 void set_arg( Expression * newValue ) { arg = newValue; } 197 197 198 198 virtual CastExpr * clone() const { return new CastExpr( * this ); } 199 virtual void accept( Visitor & v ) { v.visit( this ); } 200 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 201 virtual void print( std::ostream & os, int indent = 0 ) const; 202 private: 203 Expression * arg; 204 }; 205 206 /// VirtualCastExpr repersents a virtual dynamic cast, e.g. (virtual exception)e 207 class VirtualCastExpr : public Expression { 208 public: 209 VirtualCastExpr( Expression * arg, Type * toType ); 210 VirtualCastExpr( const VirtualCastExpr & other ); 211 virtual ~VirtualCastExpr(); 212 213 Expression * get_arg() const { return arg; } 214 void set_arg( Expression * newValue ) { arg = newValue; } 215 216 virtual VirtualCastExpr * clone() const { return new VirtualCastExpr( * this ); } 199 217 virtual void accept( Visitor & v ) { v.visit( this ); } 200 218 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } -
src/SynTree/Mutator.cc
rb947fb2 ra5f0529 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 22 13:43:00 201713 // Update Count : 2 412 // Last Modified On : Mon Jul 24 16:32:00 2017 13 // Update Count : 25 14 14 // 15 15 … … 235 235 } 236 236 237 Expression *Mutator::mutate( VirtualCastExpr *castExpr ) { 238 castExpr->set_env( maybeMutate( castExpr->get_env(), *this ) ); 239 castExpr->set_result( maybeMutate( castExpr->get_result(), *this ) ); 240 castExpr->set_arg( maybeMutate( castExpr->get_arg(), *this ) ); 241 return castExpr; 242 } 243 237 244 Expression *Mutator::mutate( UntypedMemberExpr *memberExpr ) { 238 245 memberExpr->set_env( maybeMutate( memberExpr->get_env(), *this ) ); -
src/SynTree/Mutator.h
rb947fb2 ra5f0529 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:51:30 201713 // Update Count : 1 511 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jul 24 16:31:00 2017 13 // Update Count : 16 14 14 // 15 15 #include <cassert> … … 59 59 virtual Expression* mutate( LabelAddressExpr *labAddressExpr ); 60 60 virtual Expression* mutate( CastExpr *castExpr ); 61 virtual Expression* mutate( VirtualCastExpr *castExpr ); 61 62 virtual Expression* mutate( UntypedMemberExpr *memberExpr ); 62 63 virtual Expression* mutate( MemberExpr *memberExpr ); -
src/SynTree/SynTree.h
rb947fb2 ra5f0529 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:51:46201713 // Update Count : 1 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jul 24 16:54:00 2017 13 // Update Count : 11 14 14 // 15 15 … … 66 66 class LabelAddressExpr; 67 67 class CastExpr; 68 class VirtualCastExpr; 68 69 class MemberExpr; 69 70 class UntypedMemberExpr; -
src/SynTree/Visitor.cc
rb947fb2 ra5f0529 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 22 13:41:00 201713 // Update Count : 2 612 // Last Modified On : Mon Jul 24 16:30:00 2017 13 // Update Count : 27 14 14 // 15 15 … … 192 192 } 193 193 194 void Visitor::visit( VirtualCastExpr *castExpr ) { 195 maybeAccept( castExpr->get_result(), *this ); 196 maybeAccept( castExpr->get_arg(), *this ); 197 } 198 194 199 void Visitor::visit( UntypedMemberExpr *memberExpr ) { 195 200 maybeAccept( memberExpr->get_result(), *this ); -
src/SynTree/Visitor.h
rb947fb2 ra5f0529 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:54:04201713 // Update Count : 1 211 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jul 24 16:28:00 2017 13 // Update Count : 13 14 14 // 15 15 … … 60 60 virtual void visit( NameExpr *nameExpr ); 61 61 virtual void visit( CastExpr *castExpr ); 62 virtual void visit( VirtualCastExpr *castExpr ); 62 63 virtual void visit( AddressExpr *addressExpr ); 63 64 virtual void visit( LabelAddressExpr *labAddressExpr );
Note: See TracChangeset
for help on using the changeset viewer.