Changeset 172d9342 for src/AST/Convert.cpp
- Timestamp:
- May 17, 2019, 4:01:50 PM (4 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:
- f6964ef
- Parents:
- 74dbbf6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r74dbbf6 r172d9342 16 16 #include "Convert.hpp" 17 17 18 #include "AST/Pass.hpp"19 20 18 #include "AST/Attribute.hpp" 21 19 #include "AST/Decl.hpp" … … 23 21 #include "AST/Init.hpp" 24 22 #include "AST/Stmt.hpp" 25 23 #include "AST/TypeSubstitution.hpp" 26 24 27 25 #include "SynTree/Attribute.h" 28 26 #include "SynTree/Declaration.h" 27 #include "SynTree/TypeSubstitution.h" 29 28 30 29 //================================================================================================ … … 496 495 497 496 const ast::Init * visit( const ast::ConstructorInit * node ) override final { 498 (void)node;499 return nullptr;500 }501 502 const ast::Constant * visit( const ast::Constant * node ) override final {503 497 (void)node; 504 498 return nullptr; … … 970 964 } 971 965 966 ast::TypeSubstitution * convertTypeSubstitution(const TypeSubstitution * old) { 967 968 ast::TypeSubstitution *rslt = new ast::TypeSubstitution(); 969 970 for (decltype(old->begin()) old_i = old->begin(); old_i != old->end(); old_i++) { 971 rslt->add( old_i->first, 972 getAccept1<ast::Type>(old_i->second) ); 973 } 974 975 for (decltype(old->beginVar()) old_i = old->beginVar(); old_i != old->endVar(); old_i++) { 976 rslt->addVar( old_i->first, 977 getAccept1<ast::Expr>(old_i->second) ); 978 } 979 } 980 981 void convertInferUnion(ast::Expr::InferUnion &nwInferred, InferredParams oldInferParams, const std::vector<UniqueId> &oldResnSlots) { 982 983 (void) nwInferred; 984 (void) oldInferParams; 985 (void) oldResnSlots; 986 987 // TODO 988 } 989 990 ast::Expr * visitBaseExpr(Expression * old, ast::Expr * nw) { 991 992 nw->result = GET_ACCEPT_1(result, Type); 993 nw->env = convertTypeSubstitution(old->env); 994 995 nw->extension = old->extension; 996 convertInferUnion(nw->inferred, old->inferParams, old->resnSlots); 997 998 return nw; 999 } 1000 972 1001 virtual void visit( ApplicationExpr * ) override final { 973 1002 // TODO 974 1003 } 975 1004 976 1005 virtual void visit( UntypedExpr * ) override final { 977 978 } 979 980 virtual void visit( NameExpr * ) override final { 981 1006 // TODO 1007 } 1008 1009 virtual void visit( NameExpr * old ) override final { 1010 this->node = visitBaseExpr( old, 1011 new ast::NameExpr( 1012 old->location, 1013 old->get_name() 1014 ) 1015 ); 982 1016 } 983 1017 984 1018 virtual void visit( CastExpr * ) override final { 985 1019 // TODO ... (rest) 986 1020 } 987 1021
Note: See TracChangeset
for help on using the changeset viewer.