Changeset 9b4f329 for src/Tuples


Ignore:
Timestamp:
May 16, 2019, 6:46:51 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
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:
246c245
Parents:
f3cc5b6
Message:

Finished porting AST::Expr subclasses

Location:
src/Tuples
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Tuples/TupleExpansion.cc

    rf3cc5b6 r9b4f329  
    1717#include <cassert>                // for assert
    1818#include <list>                   // for list
    19 
     19#include <vector>
     20
     21#include "AST/CVQualifiers.hpp"
     22#include "AST/Expr.hpp"
     23#include "AST/Node.hpp"
     24#include "AST/Type.hpp"
    2025#include "Common/PassVisitor.h"   // for PassVisitor, WithDeclsToAdd, WithGu...
    2126#include "Common/ScopedMap.h"     // for ScopedMap
     
    314319                return new TupleType( qualifiers, types );
    315320        }
     321        const ast::Type * makeTupleType( const std::vector<ast::ptr<ast::Expr>> & exprs ) {
     322                assert(!"implemented; needs Type.cpp in build");
     323                // // produce the TupleType which aggregates the types of the exprs
     324                // std::vector<ast::ptr<ast::Type>> types;
     325                // ast::CV::Qualifiers quals{
     326                //      ast::CV::Const | ast::CV::Volatile | ast::CV::Restrict | ast::CV::Lvalue |
     327                //      ast::CV::Atomic | ast::CV::Mutex };
     328               
     329                // for ( const ast::Expr * expr : exprs ) {
     330                //      assert( expr->result );
     331                //      // if the type of any expr is void, the type of the entire tuple is void
     332                //      if ( expr->result->isVoid() ) return new ast::VoidType{};
     333
     334                //      // qualifiers on the tuple type are the qualifiers that exist on all components
     335                //      quals &= expr->result->qualifiers;
     336
     337                //      types.emplace_back( expr->result );
     338                // }
     339
     340                // if ( exprs.empty() ) { quals = ast::CV::Qualifiers{}; }
     341                // return new ast::TupleType{ std::move(types), quals };
     342        }
    316343
    317344        TypeInstType * isTtype( Type * type ) {
  • src/Tuples/Tuples.h

    rf3cc5b6 r9b4f329  
    1919#include <vector>
    2020
     21#include "AST/Fwd.hpp"
     22#include "AST/Node.hpp"
    2123#include "SynTree/Expression.h"
    2224#include "SynTree/Declaration.h"
     
    4244        /// returns VoidType if any of the expressions have Voidtype, otherwise TupleType of the Expression result types
    4345        Type * makeTupleType( const std::list< Expression * > & exprs );
     46        const ast::Type * makeTupleType( const std::vector<ast::ptr<ast::Expr>> & exprs );
    4447
    4548        /// returns a TypeInstType if `type` is a ttype, nullptr otherwise
Note: See TracChangeset for help on using the changeset viewer.