Ignore:
Timestamp:
May 17, 2019, 4:03:23 PM (5 years ago)
Author:
Andrew Beach <ajbeach@…>
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:
7b149bc
Parents:
675d816 (diff), 172d9342 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    r675d816 rf6964ef  
    1616#include "Convert.hpp"
    1717
    18 #include "AST/Pass.hpp"
    19 
    2018#include "AST/Attribute.hpp"
    2119#include "AST/Decl.hpp"
     
    2321#include "AST/Init.hpp"
    2422#include "AST/Stmt.hpp"
    25 
     23#include "AST/TypeSubstitution.hpp"
    2624
    2725#include "SynTree/Attribute.h"
    2826#include "SynTree/Declaration.h"
     27#include "SynTree/TypeSubstitution.h"
    2928
    3029//================================================================================================
     
    11721171        }
    11731172
     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                // TODO
     1195        }
     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
    11741208        virtual void visit( ApplicationExpr * ) override final {
    1175 
     1209                // TODO
    11761210        }
    11771211
    11781212        virtual void visit( UntypedExpr * ) override final {
    1179 
    1180         }
    1181 
    1182         virtual void visit( NameExpr * ) override final {
    1183 
     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                );
    11841223        }
    11851224
    11861225        virtual void visit( CastExpr * ) override final {
    1187 
     1226                // TODO ... (rest)
    11881227        }
    11891228
Note: See TracChangeset for help on using the changeset viewer.