Changeset 2f42718 for src/SynTree


Ignore:
Timestamp:
Feb 22, 2019, 10:43:29 AM (7 years ago)
Author:
tdelisle <tdelisle@…>
Branches:
no_list
Parents:
43e0949
Message:

Parameters and return value of functions are now vectors (and some related clean-up)

Location:
src/SynTree
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.h

    r43e0949 r2f42718  
    182182        Type *base;
    183183        std::list< TypeDecl* > parameters;
    184         std::list< DeclarationWithType* > assertions;
     184        std::vector< DeclarationWithType* > assertions;
    185185
    186186        NamedTypeDecl( const std::string &name, Type::StorageClasses scs, Type *type );
     
    191191        void set_base( Type *newValue ) { base = newValue; }
    192192        std::list< TypeDecl* >& get_parameters() { return parameters; }
    193         std::list< DeclarationWithType* >& get_assertions() { return assertions; }
    194193
    195194        virtual std::string typeString() const = 0;
  • src/SynTree/FunctionType.cc

    r43e0949 r2f42718  
    3939
    4040namespace {
    41         bool containsTtype( const std::list<DeclarationWithType * > & l ) {
     41        bool containsTtype( const std::vector<DeclarationWithType * > & l ) {
    4242                if ( ! l.empty() ) {
    4343                        return Tuples::isTtype( l.back()->get_type() );
  • src/SynTree/TupleExpr.cc

    r43e0949 r2f42718  
    6666        TupleType * type = strict_dynamic_cast< TupleType * >( tuple->get_result() );
    6767        assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested index %d in expr %s", type->size(), index, toString( tuple ).c_str() );
    68         set_result( (*std::next( type->get_types().begin(), index ))->clone() );
     68        set_result( (*std::next( type->types.begin(), index ))->clone() );
    6969        // like MemberExpr, TupleIndexExpr is always an lvalue
    7070        get_result()->set_lvalue( true );
  • src/SynTree/TupleType.cc

    r43e0949 r2f42718  
    2525class Attribute;
    2626
    27 TupleType::TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types, const std::vector< Attribute * > & attributes ) : Type( tq, attributes ), types( types ) {
     27TupleType::TupleType( const Type::Qualifiers &tq, const std::vector< Type * > & types, const std::vector< Attribute * > & attributes ) : Type( tq, attributes ), types( types ) {
    2828        for ( Type * t : *this ) {
    2929                // xxx - this is very awkward. TupleTypes should contain objects so that members can be named, but if they don't have an initializer node then
  • src/SynTree/Type.h

    r43e0949 r2f42718  
    359359class FunctionType : public Type {
    360360  public:
    361         std::list<DeclarationWithType*> returnVals;
    362         std::list<DeclarationWithType*> parameters;
     361        std::vector<DeclarationWithType*> returnVals;
     362        std::vector<DeclarationWithType*> parameters;
    363363
    364364        // Does the function accept a variable number of arguments following the arguments specified in the parameters list.
     
    372372        virtual ~FunctionType();
    373373
    374         std::list<DeclarationWithType*> & get_returnVals() { return returnVals; }
    375         std::list<DeclarationWithType*> & get_parameters() { return parameters; }
    376374        bool get_isVarArgs() const { return isVarArgs; }
    377375        void set_isVarArgs( bool newValue ) { isVarArgs = newValue; }
     
    564562class TupleType : public Type {
    565563  public:
    566         std::list<Type *> types;
     564        std::vector<Type *> types;
    567565        std::list<Declaration *> members;
    568566
    569         TupleType( const Type::Qualifiers & tq, const std::list< Type * > & types, const std::vector< Attribute * > & attributes = std::vector< Attribute * >()  );
     567        TupleType( const Type::Qualifiers & tq, const std::vector< Type * > & types, const std::vector< Attribute * > & attributes = std::vector< Attribute * >()  );
    570568        TupleType( const TupleType& );
    571569        virtual ~TupleType();
    572570
    573         typedef std::list<Type*> value_type;
     571        typedef std::vector< Type * > value_type;
    574572        typedef value_type::iterator iterator;
    575573
    576         std::list<Type *> & get_types() { return types; }
    577574        virtual unsigned size() const override { return types.size(); };
    578575
Note: See TracChangeset for help on using the changeset viewer.