Changes in / [6380f78:f4c2f1a]
- Location:
- src
- Files:
-
- 2 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Expr.cpp
r6380f78 rf4c2f1a 20 20 #include <vector> 21 21 22 #include "GenericSubstitution.hpp"23 22 #include "Stmt.hpp" 24 23 #include "Type.hpp" 25 #include "TypeSubstitution.hpp"26 24 #include "Common/utility.h" 27 25 #include "Common/SemanticError.h" … … 159 157 assert( aggregate->result ); 160 158 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; 159 assert(!"unimplemented; need TypeSubstitution, genericSubstitution"); 170 160 } 171 161 -
src/AST/Node.hpp
r6380f78 rf4c2f1a 94 94 std::ostream& operator<< ( std::ostream& out, const Node * node ); 95 95 96 /// Call a visitor on a possibly-null node97 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 102 96 /// Base class for the smart pointer types 103 97 /// should never really be used. -
src/AST/Pass.hpp
r6380f78 rf4c2f1a 223 223 }; 224 224 225 /// Apply a pass to an entire translation unit226 225 template<typename pass_t> 227 226 void accept_all( std::list< ast::ptr<ast::Decl> > &, ast::Pass<pass_t> & visitor ); -
src/AST/TypeSubstitution.hpp
r6380f78 rf4c2f1a 25 25 #include "Fwd.hpp" // for UniqueId 26 26 #include "ParseNode.hpp" 27 #include "Type.hpp" 27 #include "Type.hpp" // for ptr<Type> 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 = strict_dynamic_cast< SynTreeClass * >( input->accept( sub ) ); 167 input = dynamic_cast< SynTreeClass * >( input->acceptMutator( sub ) ); 168 assert( input ); 168 169 /// std::cerr << "substitution result is: "; 169 170 /// newType->print( std::cerr ); … … 176 177 assert( input ); 177 178 Pass<Substituter> sub( *this, true ); 178 input = strict_dynamic_cast< SynTreeClass * >( input->accept( sub ) ); 179 input = dynamic_cast< SynTreeClass * >( input->acceptMutator( sub ) ); 180 assert( input ); 179 181 /// std::cerr << "substitution result is: "; 180 182 /// newType->print( std::cerr ); -
src/AST/module.mk
r6380f78 rf4c2f1a 21 21 AST/DeclReplacer.cpp \ 22 22 AST/Expr.cpp \ 23 AST/GenericSubstitution.cpp \24 23 AST/Init.cpp \ 25 24 AST/LinkageSpec.cpp \ -
src/AST/porting.md
r6380f78 rf4c2f1a 38 38 39 39 `N->print(std::ostream&)` is a visitor now, port these methods to `ast::Print` class 40 * **TODO** `Declaration::printShort` should also be integrated 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 41 43 42 44 `clone` is private to `Node` now … … 206 208 207 209 `CompoundStmt` 210 * **TODO** port copy operator 211 * Needs to be an almost-shallow clone, where the declarations are cloned only if needed 212 * **TODO** port `DeclReplacer` 208 213 * Still a `std::list` for children, rather than `std::vector` 209 214 * allows more-efficient splicing for purposes of later code generation … … 224 229 * `getAggr()` => `aggr()` 225 230 * also now returns `const AggregateDecl *` 226 * `genericSubstitution()` moved to own visitor in `AST/GenericSubstitution.hpp` 231 * `genericSubstitution()` moved to own visitor in `AST/GenericSubstitution.hpp` **TODO** write 227 232 228 233 `BasicType` -
src/Makefile.in
r6380f78 rf4c2f1a 167 167 am__objects_1 = AST/Attribute.$(OBJEXT) AST/Convert.$(OBJEXT) \ 168 168 AST/Decl.$(OBJEXT) AST/DeclReplacer.$(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) 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) 174 173 am__objects_2 = CodeGen/CodeGenerator.$(OBJEXT) \ 175 174 CodeGen/FixMain.$(OBJEXT) CodeGen/GenType.$(OBJEXT) \ … … 575 574 AST/DeclReplacer.cpp \ 576 575 AST/Expr.cpp \ 577 AST/GenericSubstitution.cpp \578 576 AST/Init.cpp \ 579 577 AST/LinkageSpec.cpp \ … … 741 739 AST/$(DEPDIR)/$(am__dirstamp) 742 740 AST/Expr.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp) 743 AST/GenericSubstitution.$(OBJEXT): AST/$(am__dirstamp) \744 AST/$(DEPDIR)/$(am__dirstamp)745 741 AST/Init.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp) 746 742 AST/LinkageSpec.$(OBJEXT): AST/$(am__dirstamp) \ … … 1177 1173 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/DeclReplacer.Po@am__quote@ 1178 1174 @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@1180 1175 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Init.Po@am__quote@ 1181 1176 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/LinkageSpec.Po@am__quote@
Note: See TracChangeset
for help on using the changeset viewer.