- Timestamp:
- May 22, 2019, 3:38:47 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 6380f78
- Parents:
- 37eef7a
- Location:
- src/AST
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Expr.cpp
r37eef7a rd8938622 20 20 #include <vector> 21 21 22 #include "GenericSubstitution.hpp" 22 23 #include "Stmt.hpp" 23 24 #include "Type.hpp" 25 #include "TypeSubstitution.hpp" 24 26 #include "Common/utility.h" 25 27 #include "Common/SemanticError.h" … … 157 159 assert( aggregate->result ); 158 160 159 assert(!"unimplemented; need TypeSubstitution, genericSubstitution"); 161 // take ownership of member type 162 Type * res = result.set_and_mutate( mem->get_type() ); 163 // substitute aggregate generic parameters into member type 164 genericSubsitution( aggregate->result ).apply( res ); 165 // ensure lvalue and appropriate restrictions from aggregate type 166 res->set_lvalue( true ); 167 res->qualifiers |= aggregate->result->qualifiers; 168 // ensure changes propegated back into result 169 result = res; 160 170 } 161 171 -
src/AST/Node.hpp
r37eef7a rd8938622 94 94 std::ostream& operator<< ( std::ostream& out, const Node * node ); 95 95 96 /// Call a visitor on a possibly-null node 97 template<typename node_t> 98 auto maybe_accept( const node_t * n, Visitor & v ) -> decltype( n->accept(v) ) { 99 return n ? n->accept( v ) : nullptr; 100 } 101 96 102 /// Base class for the smart pointer types 97 103 /// should never really be used. -
src/AST/Pass.hpp
r37eef7a rd8938622 223 223 }; 224 224 225 /// Apply a pass to an entire translation unit 225 226 template<typename pass_t> 226 227 void accept_all( std::list< ast::ptr<ast::Decl> > &, ast::Pass<pass_t> & visitor ); -
src/AST/Stmt.cpp
r37eef7a rd8938622 22 22 // --- CompoundStmt 23 23 CompoundStmt::CompoundStmt( const CompoundStmt& o ) : Stmt(o), kids(o.kids) { 24 # warning unimplemented 24 25 assert(!"implemented"); 25 26 } -
src/AST/TypeSubstitution.hpp
r37eef7a rd8938622 25 25 #include "Fwd.hpp" // for UniqueId 26 26 #include "ParseNode.hpp" 27 #include "Type.hpp" // for ptr<Type>27 #include "Type.hpp" 28 28 #include "Common/SemanticError.h" // for SemanticError 29 29 #include "Visitor.hpp" … … 165 165 assert( input ); 166 166 Pass<Substituter> sub( *this, false ); 167 input = dynamic_cast< SynTreeClass * >( input->acceptMutator( sub ) ); 168 assert( input ); 167 input = strict_dynamic_cast< SynTreeClass * >( input->accept( sub ) ); 169 168 /// std::cerr << "substitution result is: "; 170 169 /// newType->print( std::cerr ); … … 177 176 assert( input ); 178 177 Pass<Substituter> sub( *this, true ); 179 input = dynamic_cast< SynTreeClass * >( input->acceptMutator( sub ) ); 180 assert( input ); 178 input = strict_dynamic_cast< SynTreeClass * >( input->accept( sub ) ); 181 179 /// std::cerr << "substitution result is: "; 182 180 /// newType->print( std::cerr ); -
src/AST/module.mk
r37eef7a rd8938622 21 21 AST/DeclReplacer.cpp \ 22 22 AST/Expr.cpp \ 23 AST/GenericSubstitution.cpp \ 23 24 AST/Init.cpp \ 24 25 AST/LinkageSpec.cpp \ -
src/AST/porting.md
r37eef7a rd8938622 38 38 39 39 `N->print(std::ostream&)` is a visitor now, port these methods to `ast::Print` class 40 * **TODO** write this visitor 41 * **TODO** write `std::ostream& operator<< ( std::ostream& out, const Node* node )` in `Node.hpp` in terms of `ast::Print` 42 * `Declaration::printShort` should also be integrated 40 * **TODO** `Declaration::printShort` should also be integrated 43 41 44 42 `clone` is private to `Node` now … … 208 206 209 207 `CompoundStmt` 210 * **TODO** port copy operator211 * Needs to be an almost-shallow clone, where the declarations are cloned only if needed212 * **TODO** port `DeclReplacer`213 208 * Still a `std::list` for children, rather than `std::vector` 214 209 * allows more-efficient splicing for purposes of later code generation … … 229 224 * `getAggr()` => `aggr()` 230 225 * also now returns `const AggregateDecl *` 231 * `genericSubstitution()` moved to own visitor in `AST/GenericSubstitution.hpp` **TODO** write226 * `genericSubstitution()` moved to own visitor in `AST/GenericSubstitution.hpp` 232 227 233 228 `BasicType`
Note: See TracChangeset
for help on using the changeset viewer.