Changeset ba54f7d for src/SynTree
- Timestamp:
- Sep 13, 2017, 3:11:24 PM (8 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:
- c57ded70, db70fe4
- Parents:
- d130fe8 (diff), 982832e (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. - Location:
- src/SynTree
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/AddressExpr.cc
rd130fe8 rba54f7d 47 47 } else { 48 48 // taking address of non-lvalue -- must be a reference, loses one layer of reference 49 ReferenceType * refType = s afe_dynamic_cast< ReferenceType * >( arg->get_result() );49 ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( arg->get_result() ); 50 50 set_result( addrType( refType->get_base() ) ); 51 51 } -
src/SynTree/ApplicationExpr.cc
rd130fe8 rba54f7d 14 14 // 15 15 16 #include <cassert> // for s afe_dynamic_cast, assert16 #include <cassert> // for strict_dynamic_cast, assert 17 17 #include <list> // for list 18 18 #include <map> // for _Rb_tree_const_iterator, map, map<>:... … … 50 50 51 51 ApplicationExpr::ApplicationExpr( Expression *funcExpr, const std::list<Expression *> & args ) : function( funcExpr ), args( args ) { 52 PointerType *pointer = s afe_dynamic_cast< PointerType* >( funcExpr->get_result() );53 FunctionType *function = s afe_dynamic_cast< FunctionType* >( pointer->get_base() );52 PointerType *pointer = strict_dynamic_cast< PointerType* >( funcExpr->get_result() ); 53 FunctionType *function = strict_dynamic_cast< FunctionType* >( pointer->get_base() ); 54 54 55 55 set_result( ResolvExpr::extractResultType( function ) ); -
src/SynTree/CompoundStmt.cc
rd130fe8 rba54f7d 14 14 // 15 15 16 #include <cassert> // for assert, s afe_dynamic_cast16 #include <cassert> // for assert, strict_dynamic_cast 17 17 #include <list> // for list, _List_const_iterator, lis... 18 18 #include <ostream> // for operator<<, ostream, basic_ostream … … 52 52 Statement * origStmt = *origit++; 53 53 if ( DeclStmt * declStmt = dynamic_cast< DeclStmt * >( s ) ) { 54 DeclStmt * origDeclStmt = s afe_dynamic_cast< DeclStmt * >( origStmt );54 DeclStmt * origDeclStmt = strict_dynamic_cast< DeclStmt * >( origStmt ); 55 55 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * > ( declStmt->get_decl() ) ) { 56 DeclarationWithType * origdwt = s afe_dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() );56 DeclarationWithType * origdwt = strict_dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() ); 57 57 assert( dwt->get_name() == origdwt->get_name() ); 58 58 declMap[ origdwt ] = dwt; -
src/SynTree/Constant.cc
rd130fe8 rba54f7d 14 14 // 15 15 16 #include <cassert> // for s afe_dynamic_cast, assertf16 #include <cassert> // for strict_dynamic_cast, assertf 17 17 #include <iostream> // for operator<<, ostream, basic_ostream 18 18 #include <string> // for to_string, string, char_traits, operator<< … … 58 58 59 59 unsigned long long Constant::get_ival() const { 60 assertf( s afe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." );60 assertf( strict_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." ); 61 61 return val.ival; 62 62 } 63 63 64 64 double Constant::get_dval() const { 65 assertf( ! s afe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." );65 assertf( ! strict_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." ); 66 66 return val.dval; 67 67 } -
src/SynTree/Declaration.h
rd130fe8 rba54f7d 157 157 virtual ~FunctionDecl(); 158 158 159 Type * get_type() const ;160 virtual void set_type(Type * );159 Type * get_type() const { return type; } 160 virtual void set_type(Type * t) { type = strict_dynamic_cast< FunctionType* >( t ); } 161 161 162 162 FunctionType * get_functionType() const { return type; } -
src/SynTree/Expression.h
rd130fe8 rba54f7d 86 86 public: 87 87 Expression * function; 88 std::list<Expression *> args; 89 InferredParams inferParams; 88 90 89 91 ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() ); … … 100 102 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 101 103 virtual void print( std::ostream & os, int indent = 0 ) const; 102 103 private:104 std::list<Expression *> args;105 InferredParams inferParams;106 104 }; 107 105 -
src/SynTree/FunctionDecl.cc
rd130fe8 rba54f7d 44 44 delete type; 45 45 delete statements; 46 }47 48 Type * FunctionDecl::get_type() const {49 return type;50 }51 52 void FunctionDecl::set_type( Type *t ) {53 type = dynamic_cast< FunctionType* >( t );54 assert( type );55 46 } 56 47 -
src/SynTree/Statement.h
rd130fe8 rba54f7d 155 155 public: 156 156 Expression * condition; 157 std::list<Statement *> statements; 157 158 158 159 SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &statements ); … … 170 171 virtual SwitchStmt *clone() const { return new SwitchStmt( *this ); } 171 172 virtual void print( std::ostream &os, int indent = 0 ) const; 172 private: 173 std::list<Statement *> statements; 173 174 174 }; 175 175 … … 327 327 class TryStmt : public Statement { 328 328 public: 329 CompoundStmt * block;329 CompoundStmt * block; 330 330 std::list<CatchStmt *> handlers; 331 FinallyStmt * finallyBlock;331 FinallyStmt * finallyBlock; 332 332 333 333 TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 ); -
src/SynTree/TupleExpr.cc
rd130fe8 rba54f7d 14 14 // 15 15 16 #include <cassert> // for assert, s afe_dynamic_cast, assertf16 #include <cassert> // for assert, strict_dynamic_cast, assertf 17 17 #include <iterator> // for next 18 18 #include <list> // for list, _List_iterator … … 64 64 65 65 TupleIndexExpr::TupleIndexExpr( Expression * tuple, unsigned int index ) : tuple( tuple ), index( index ) { 66 TupleType * type = s afe_dynamic_cast< TupleType * >( tuple->get_result() );66 TupleType * type = strict_dynamic_cast< TupleType * >( tuple->get_result() ); 67 67 assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested index %d in expr %s", type->size(), index, toString( tuple ).c_str() ); 68 68 set_result( (*std::next( type->get_types().begin(), index ))->clone() ); -
src/SynTree/Visitor.h
rd130fe8 rba54f7d 148 148 } 149 149 150 template< typename Container, typename VisitorType >151 void acceptAllFold( Container &container, VisitorType &visitor, VisitorType &around ) {152 SemanticError errors;153 for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {154 try {155 if ( *i ) {156 VisitorType *v = new VisitorType;157 (*i)->accept( *v );158 159 typename Container::iterator nxt = i; nxt++; // forward_iterator160 if ( nxt == container.end() )161 visitor += *v;162 else163 visitor += *v + around;164 165 delete v;166 } // if167 } catch( SemanticError &e ) {168 e.set_location( (*i)->location );169 errors.append( e );170 } // try171 } // for172 if ( ! errors.isEmpty() ) {173 throw errors;174 } // if175 }176 177 150 // Local Variables: // 178 151 // tab-width: 4 //
Note:
See TracChangeset
for help on using the changeset viewer.