Changes in / [f6964ef:675d816]
- Location:
- src
- Files:
-
- 1 deleted
- 6 edited
-
AST/Convert.cpp (modified) (3 diffs)
-
AST/Pass.hpp (modified) (2 diffs)
-
AST/TypeSubstitution.cpp (modified) (1 diff)
-
AST/TypeSubstitution.hpp (modified) (2 diffs)
-
AST/module.mk (deleted)
-
SynTree/TypeSubstitution.cc (modified) (1 diff)
-
SynTree/TypeSubstitution.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
rf6964ef r675d816 16 16 #include "Convert.hpp" 17 17 18 #include "AST/Pass.hpp" 19 18 20 #include "AST/Attribute.hpp" 19 21 #include "AST/Decl.hpp" … … 21 23 #include "AST/Init.hpp" 22 24 #include "AST/Stmt.hpp" 23 #include "AST/TypeSubstitution.hpp" 25 24 26 25 27 #include "SynTree/Attribute.h" 26 28 #include "SynTree/Declaration.h" 27 #include "SynTree/TypeSubstitution.h"28 29 29 30 //================================================================================================ … … 1171 1172 } 1172 1173 1173 ast::TypeSubstitution * convertTypeSubstitution(const TypeSubstitution * old) {1174 1175 ast::TypeSubstitution *rslt = new ast::TypeSubstitution();1176 1177 for (decltype(old->begin()) old_i = old->begin(); old_i != old->end(); old_i++) {1178 rslt->add( old_i->first,1179 getAccept1<ast::Type>(old_i->second) );1180 }1181 1182 for (decltype(old->beginVar()) old_i = old->beginVar(); old_i != old->endVar(); old_i++) {1183 rslt->addVar( old_i->first,1184 getAccept1<ast::Expr>(old_i->second) );1185 }1186 }1187 1188 void convertInferUnion(ast::Expr::InferUnion &nwInferred, InferredParams oldInferParams, const std::vector<UniqueId> &oldResnSlots) {1189 1190 (void) nwInferred;1191 (void) oldInferParams;1192 (void) oldResnSlots;1193 1194 // TODO1195 }1196 1197 ast::Expr * visitBaseExpr(Expression * old, ast::Expr * nw) {1198 1199 nw->result = GET_ACCEPT_1(result, Type);1200 nw->env = convertTypeSubstitution(old->env);1201 1202 nw->extension = old->extension;1203 convertInferUnion(nw->inferred, old->inferParams, old->resnSlots);1204 1205 return nw;1206 }1207 1208 1174 virtual void visit( ApplicationExpr * ) override final { 1209 // TODO 1175 1210 1176 } 1211 1177 1212 1178 virtual void visit( UntypedExpr * ) override final { 1213 // TODO 1214 } 1215 1216 virtual void visit( NameExpr * old ) override final { 1217 this->node = visitBaseExpr( old, 1218 new ast::NameExpr( 1219 old->location, 1220 old->get_name() 1221 ) 1222 ); 1179 1180 } 1181 1182 virtual void visit( NameExpr * ) override final { 1183 1223 1184 } 1224 1185 1225 1186 virtual void visit( CastExpr * ) override final { 1226 // TODO ... (rest) 1187 1227 1188 } 1228 1189 -
src/AST/Pass.hpp
rf6964ef r675d816 300 300 #include "Common/Stats.h" 301 301 302 namespace ast {303 302 extern struct PassVisitorStats { 304 303 size_t depth = 0; … … 306 305 Stats::Counters::AverageCounter<double> * avg = nullptr; 307 306 } pass_visitor_stats; 308 }309 307 310 308 #include "AST/Pass.impl.hpp" -
src/AST/TypeSubstitution.cpp
rf6964ef r675d816 58 58 void TypeSubstitution::add( std::string formalType, const Type *actualType ) { 59 59 typeEnv[ formalType ] = actualType; 60 }61 62 void TypeSubstitution::addVar( std::string formalExpr, const Expr *actualExpr ) {63 varEnv[ formalExpr ] = actualExpr;64 60 } 65 61 -
src/AST/TypeSubstitution.hpp
rf6964ef r675d816 52 52 bool empty() const; 53 53 54 void addVar( std::string formalExpr, const Expr *actualExpr );55 56 54 template< typename FormalIterator, typename ActualIterator > 57 55 void add( FormalIterator formalBegin, FormalIterator formalEnd, ActualIterator actualBegin ); … … 89 87 auto begin() const -> decltype( typeEnv.begin() ) { return typeEnv.begin(); } 90 88 auto end() const -> decltype( typeEnv. end() ) { return typeEnv. end(); } 91 92 auto beginVar() -> decltype( varEnv.begin() ) { return varEnv.begin(); }93 auto endVar() -> decltype( varEnv. end() ) { return varEnv. end(); }94 auto beginVar() const -> decltype( varEnv.begin() ) { return varEnv.begin(); }95 auto endVar() const -> decltype( varEnv. end() ) { return varEnv. end(); }96 89 }; 97 90 -
src/SynTree/TypeSubstitution.cc
rf6964ef r675d816 62 62 } // if 63 63 typeEnv[ formalType ] = actualType->clone(); 64 }65 66 void TypeSubstitution::addVar( std::string formalExpr, Expression *actualExpr ) {67 varEnv[ formalExpr ] = actualExpr;68 64 } 69 65 -
src/SynTree/TypeSubstitution.h
rf6964ef r675d816 48 48 bool empty() const; 49 49 50 void addVar( std::string formalExpr, Expression *actualExpr );51 52 50 template< typename FormalIterator, typename ActualIterator > 53 51 void add( FormalIterator formalBegin, FormalIterator formalEnd, ActualIterator actualBegin ); … … 91 89 auto begin() const -> decltype( typeEnv.begin() ) { return typeEnv.begin(); } 92 90 auto end() const -> decltype( typeEnv. end() ) { return typeEnv. end(); } 93 94 auto beginVar() -> decltype( varEnv.begin() ) { return varEnv.begin(); }95 auto endVar() -> decltype( varEnv. end() ) { return varEnv. end(); }96 auto beginVar() const -> decltype( varEnv.begin() ) { return varEnv.begin(); }97 auto endVar() const -> decltype( varEnv. end() ) { return varEnv. end(); }98 91 }; 99 92
Note:
See TracChangeset
for help on using the changeset viewer.