Changes in / [f4c2f1a:6380f78]
- Location:
- src
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Expr.cpp
rf4c2f1a r6380f78 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
rf4c2f1a r6380f78 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
rf4c2f1a r6380f78 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/TypeSubstitution.hpp
rf4c2f1a r6380f78 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
rf4c2f1a r6380f78 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
rf4c2f1a r6380f78 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` -
src/Makefile.in
rf4c2f1a r6380f78 167 167 am__objects_1 = AST/Attribute.$(OBJEXT) AST/Convert.$(OBJEXT) \ 168 168 AST/Decl.$(OBJEXT) AST/DeclReplacer.$(OBJEXT) \ 169 AST/Expr.$(OBJEXT) AST/Init.$(OBJEXT) \ 170 AST/LinkageSpec.$(OBJEXT) AST/Node.$(OBJEXT) \ 171 AST/Pass.$(OBJEXT) AST/Print.$(OBJEXT) AST/Stmt.$(OBJEXT) \ 172 AST/Type.$(OBJEXT) AST/TypeSubstitution.$(OBJEXT) 169 AST/Expr.$(OBJEXT) AST/GenericSubstitution.$(OBJEXT) \ 170 AST/Init.$(OBJEXT) AST/LinkageSpec.$(OBJEXT) \ 171 AST/Node.$(OBJEXT) AST/Pass.$(OBJEXT) AST/Print.$(OBJEXT) \ 172 AST/Stmt.$(OBJEXT) AST/Type.$(OBJEXT) \ 173 AST/TypeSubstitution.$(OBJEXT) 173 174 am__objects_2 = CodeGen/CodeGenerator.$(OBJEXT) \ 174 175 CodeGen/FixMain.$(OBJEXT) CodeGen/GenType.$(OBJEXT) \ … … 574 575 AST/DeclReplacer.cpp \ 575 576 AST/Expr.cpp \ 577 AST/GenericSubstitution.cpp \ 576 578 AST/Init.cpp \ 577 579 AST/LinkageSpec.cpp \ … … 739 741 AST/$(DEPDIR)/$(am__dirstamp) 740 742 AST/Expr.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp) 743 AST/GenericSubstitution.$(OBJEXT): AST/$(am__dirstamp) \ 744 AST/$(DEPDIR)/$(am__dirstamp) 741 745 AST/Init.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp) 742 746 AST/LinkageSpec.$(OBJEXT): AST/$(am__dirstamp) \ … … 1173 1177 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/DeclReplacer.Po@am__quote@ 1174 1178 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Expr.Po@am__quote@ 1179 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/GenericSubstitution.Po@am__quote@ 1175 1180 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Init.Po@am__quote@ 1176 1181 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/LinkageSpec.Po@am__quote@
Note: See TracChangeset
for help on using the changeset viewer.